:root{--page-width:1280px;--page-gutter:40px;--paper:#fafafa;--surface:#fff;--ink:#202124;--muted:#62666b;--line:#dfe1e3;--soft:#f0f1f2;--serif:var(--font-ui);--sans:var(--font-ui)}
*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.6 var(--sans)}button,input,select{font:inherit;color:inherit}button,select{background:white;border:1px solid var(--line);border-radius:6px;padding:7px 12px;cursor:pointer}button:hover{background:var(--soft)}button:disabled{opacity:.5;cursor:default}a{color:inherit}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid #333;outline-offset:3px}button,input,select,a{-webkit-tap-highlight-color:transparent}.shell{width:100%;max-width:var(--page-width);margin:0 auto;padding:0 var(--page-gutter)}.header{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:28px 0 22px}.brand{display:flex;align-items:baseline;gap:16px;text-decoration:none}.wordmark{font:38px/1 var(--serif)}.brand-label,.eyebrow{font-size:12px;letter-spacing:.14em;color:var(--muted)}.header-right{display:flex;align-items:center;gap:16px}.private{font-size:14px;color:var(--muted)}nav{display:flex;gap:28px;border-bottom:1px solid var(--line);overflow-x:auto;white-space:nowrap}nav a{text-decoration:none;color:var(--muted);padding:12px 0;min-height:48px}nav a[aria-current=page]{color:var(--ink);border-bottom:2px solid var(--ink)}main{min-height:65vh;padding:34px 0 44px}h1,h2,h3,p{margin:0}h1{font:30px/1.3 var(--serif);font-weight:400}h2{font-size:19px;font-weight:500;margin-bottom:16px}h3{font-size:17px;font-weight:500}.page-head{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:26px}.subtitle{color:var(--muted);margin-top:7px;font-size:14px}.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.toolbar input{border:1px solid var(--line);border-radius:6px;padding:8px 12px;min-width:160px;width:230px;background:white}.toolbar input[type=month]{width:180px}.metrics{display:grid;grid-template-columns:repeat(4,1fr);border:1px solid var(--line);background:white;border-radius:8px;margin-bottom:30px}.metric{padding:20px 24px;border-right:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}.metric:last-child{border:0}.metric span{font-size:14px;color:var(--muted)}.metric strong{font:30px/1 var(--serif);font-weight:400}.section{margin:30px 0}.section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.section-head h2{margin:0}.section-head a{font-size:14px;color:var(--muted)}.record{display:block;width:100%;text-align:left;background:white;border:1px solid var(--line);border-radius:8px;padding:19px 22px;margin-bottom:10px;min-width:0}.record:hover{border-color:#b5b7b9;background:#fff}.record-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.record-title{overflow-wrap:anywhere;font-size:17px;line-height:1.6}.badge{display:inline-block;font-size:13px;border:1px solid var(--line);border-radius:4px;padding:2px 7px;white-space:nowrap;color:var(--muted);background:var(--paper)}.badge.in_progress{background:#292c30;color:#fff;border-color:#292c30}.record-note{margin-top:8px;color:var(--muted);font-size:14px;white-space:pre-wrap;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.record-meta{display:flex;gap:8px 18px;flex-wrap:wrap;color:var(--muted);font-size:13px;margin-top:12px}.empty{padding:28px 24px;border:1px dashed var(--line);border-radius:8px;color:var(--muted);font-size:15px;background:#fff}.notice{padding:12px 16px;margin-top:20px;background:var(--soft);border-radius:6px;font-size:14px}.note{font-size:14px;color:var(--muted);padding:12px 0 22px}.calendar{display:grid;grid-template-columns:1fr 1fr;gap:28px;height:calc(100dvh - 340px);min-height:500px;max-height:900px}.month-half{display:grid;grid-template-rows:repeat(16,minmax(0,1fr));border-top:1px solid var(--line)}.day{display:grid;grid-template-columns:61px minmax(0,1fr);border:0;border-bottom:1px solid var(--line);border-radius:0;min-height:0;padding:6px 10px;gap:12px;text-align:left;background:transparent;width:100%;align-items:center;overflow:hidden}.day.today{background:#e9ebec}.day-date{display:flex;align-items:baseline;gap:7px;font-size:17px}.day-date small{font-size:12px;color:var(--muted)}.day-events{font-size:14px;line-height:1.35;min-width:0;max-height:100%;overflow:hidden;overflow-wrap:anywhere}.day-events .day-count{font-size:12px;color:var(--muted)}.day-placeholder{border-bottom:1px solid var(--line)}.journal-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.85}.timeline{border-left:1px solid var(--line);margin-left:6px;padding-left:22px}.activity{padding:0 0 24px;position:relative}.activity:before{content:'';position:absolute;left:-26px;top:10px;width:7px;height:7px;background:#9da0a3;border-radius:50%}.activity small{color:var(--muted);font-size:13px}.activity p{margin-top:4px}.progress{height:4px;background:var(--soft);border-radius:5px;overflow:hidden;margin-top:14px}.progress-bar{height:100%;background:#555}.splitline{border-top:1px solid var(--line);padding-top:14px;margin-top:20px}footer{border-top:1px solid var(--line);padding:16px 0 24px;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;color:var(--muted);font-size:13px}footer button{font-size:13px;padding:5px 10px}dialog{width:min(640px,calc(100vw - 28px));max-height:85dvh;border:1px solid var(--line);border-radius:12px;padding:25px;box-shadow:0 20px 70px #0002;color:var(--ink)}dialog::backdrop{background:#0005}.dialog-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px}.detail-block{margin-top:20px}.detail-label{font-size:13px;color:var(--muted);margin-bottom:6px}.detail-block p{white-space:pre-wrap;overflow-wrap:anywhere}.detail-links{display:flex;gap:12px;flex-wrap:wrap}.skip{position:fixed;left:10px;top:-60px;z-index:10;background:white;padding:10px}.skip:focus{top:10px}[hidden]{display:none!important}
@media(min-width:900px) and (max-height:850px){.calendar{min-height:0;height:calc(100dvh - 335px)}main.calendar-page{padding-top:22px;padding-bottom:18px}.calendar-page .page-head{margin-bottom:10px}.calendar-page .note{padding-bottom:12px}.day{padding:3px 7px}.header{padding-top:19px;padding-bottom:18px}}
@media(max-width:760px){:root{--page-gutter:18px}.header{padding:22px 0 16px}.wordmark{font-size:32px}.brand{gap:10px}.brand-label{font-size:10px}.private{display:none}nav{gap:24px}main{padding-top:24px}.page-head{align-items:flex-start;flex-direction:column;gap:16px}h1{font-size:28px}.metrics{grid-template-columns:1fr 1fr}.metric{padding:16px;border-bottom:1px solid var(--line)}.metric:nth-child(2){border-right:0}.metric:nth-child(3){border-bottom:0}.record{padding:16px}.record-head{gap:10px}.calendar{display:block;height:auto;min-height:0;max-height:none}.month-half{display:block}.month-half+.month-half{border-top:0}.day{min-height:62px;padding:10px 4px}.day-events{max-height:42px}.day-placeholder{display:none}footer{font-size:12px;justify-content:flex-start}.toolbar{width:100%}.toolbar input{flex:1;min-width:100px}.page-head .toolbar button{min-height:44px}dialog{padding:20px}}
@media(prefers-reduced-motion:no-preference){button,a{transition:background .12s,border-color .12s}}

/* Daybook: content first; progress is an optional view. */
.record{background:transparent;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:16px 0;margin:0}.record:hover{background:var(--soft);border-color:var(--line)}.record-meta{margin-top:6px}.empty{border:0;background:transparent;padding:20px 0}.calendar-source{font-size:14px;color:var(--muted);margin:-12px 0 16px}.more-nav{position:relative;margin-left:auto}.more-nav summary{cursor:pointer;padding:12px 0;color:var(--muted);list-style:none}.more-nav summary:focus-visible{outline:2px solid var(--ink)}.more-nav div{display:flex;gap:22px}.more-nav[open]{padding-bottom:4px}.calendar{height:calc(100dvh - 290px)}
@media(max-width:760px){.more-nav div{gap:14px;flex-wrap:wrap}.more-nav[open]{max-width:170px}.calendar{height:auto}.calendar-source{margin-top:-4px}.record{padding:14px 0}nav{gap:22px;overflow:visible;flex-wrap:wrap}}

/* Fit the desktop month into the space above the footer, including wrapped notices. */
@media(min-width:761px){
  .shell:has(> main.calendar-page){height:100dvh;display:flex;flex-direction:column}
  .shell:has(> main.calendar-page)>:not(main){flex-shrink:0}
  main.calendar-page{display:flex;flex:1;flex-direction:column;min-height:0}
  .calendar-page>.page-head,.calendar-page>.calendar-source{flex-shrink:0}
  .calendar-page .calendar{flex:1;min-height:0;height:auto;grid-template-rows:minmax(0,1fr)}
  .month-half{min-height:0}
}

.task-form{display:grid;gap:16px}.task-field{display:grid;gap:6px;font-size:14px;min-width:0}.task-field input,.task-field textarea,.task-field select{width:100%;min-width:0;border:1px solid var(--line);border-radius:6px;background:white;padding:8px 10px;font:inherit;color:inherit}.task-field textarea{resize:vertical;min-height:80px}.task-field input:focus-visible,.task-field textarea:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.task-deadline{border:1px solid var(--line);padding:12px;display:grid;grid-template-columns:1fr 1fr;gap:12px;min-width:0}.task-deadline legend{font-size:14px;color:var(--muted);padding:0 6px}.task-more>summary{cursor:pointer;color:var(--muted);font-size:14px}.task-more>.task-field{margin-top:14px}.task-editor-actions,.task-detail-actions{display:flex;gap:10px;flex-wrap:wrap}.task-save-status{font-size:14px;white-space:pre-wrap;overflow-wrap:anywhere}.task-source{font-size:13px;margin-top:20px;padding-top:16px;border-top:1px solid var(--line);overflow-wrap:anywhere}.task-source p+p{margin-top:8px}.task-detail-actions{margin-top:20px}.task-view-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:18px}.task-view-tabs button[aria-pressed=true]{color:var(--surface);background:var(--ink);border-color:var(--ink)}.task-editor h2{margin-bottom:20px}
@media(max-width:760px){.task-deadline{grid-template-columns:1fr}.task-editor{max-height:90dvh}.task-field input,.task-field textarea,.task-field select{font-size:16px}.task-editor-actions button{min-height:44px}}

/* Readable rows take the space they need; short desktops scroll the page. */
.calendar{height:auto;min-height:0;max-height:none;align-items:start;gap:28px}
.month-half{display:flex;flex-direction:column}
.day{min-height:48px;overflow:visible;align-items:start;padding:10px 8px}
.day-date{padding-top:1px;flex-shrink:0}
.day-events{display:grid;gap:4px;max-height:none;overflow:visible;line-height:1.5}
.day-event{display:block;overflow-wrap:anywhere}
.day-count{display:block}.calendar-source{display:grid;gap:4px;margin-top:-12px}
.calendar-warning{color:#765319}.source-details{border-top:1px solid var(--line);padding-top:16px;margin-top:24px;overflow-wrap:anywhere}
.source-details>summary,.task-source>summary{cursor:pointer;color:var(--muted);font-size:14px}
summary:focus-visible{outline:2px solid var(--ink);outline-offset:3px}
.source-details .detail-links{margin-top:20px}.activity-description{color:var(--muted);font-size:14px}
.header{flex-wrap:wrap}.brand{min-width:0}.wordmark{font-size:clamp(28px,3.2vw,38px);white-space:nowrap}
.header-right{flex-wrap:wrap}.header-right button,.header-right a{white-space:nowrap}.record-meta{overflow-wrap:anywhere}
.calendar-controls{flex-wrap:nowrap}.calendar-controls input[type=month]{min-width:0;flex:1}.calendar-controls button{white-space:nowrap;flex-shrink:0}
@media(min-width:761px){
 .shell:has(> main.calendar-page){height:auto;min-height:100dvh;display:block}
 main.calendar-page{display:block;min-height:65vh}
 .calendar-page .calendar{display:grid;grid-template-rows:auto;min-height:0;height:auto}
}
@media(max-width:760px){
 .header{gap:14px;align-items:flex-start}.header-right{margin-left:auto;gap:10px}.header-right button,.header-right a{min-height:44px;display:flex;align-items:center}
 .shell>nav{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:0;width:100%;font-size:14px;overflow:visible;align-items:start}
 .shell>nav>a{text-align:center}.more-nav{margin-left:0;min-width:0;text-align:center}.more-nav summary{min-height:48px}
 .more-nav[open]{grid-column:1/-1;max-width:none;text-align:left;width:100%}.more-nav div{display:flex;flex-wrap:wrap;gap:24px}
 .calendar{display:block}.day{min-height:62px;padding:12px 4px}.day-events{max-height:none}
 .toolbar input{width:100%;max-width:100%}.toolbar select{max-width:100%}.calendar-controls{gap:8px}
 .calendar-controls input[type=month]{width:0;min-width:0;padding:8px 4px}.calendar-controls button{padding:8px}
 .source-details{margin-top:20px}.page-head{width:100%}.page-head>div{min-width:0}
}

.detail-block .task-description{font:16px/1.75 var(--sans)}.detail-block .task-description p:last-child{margin-bottom:0}.task-description h2{font-size:21px}.task-description h3{font-size:19px}

/* Every route shares the shell's outer edges; reading measures stay inside it. */
#main{width:100%;max-width:none;min-width:0;margin-inline:0}
/* Reserve classic scrollbars across short/long pages without narrowing mobile
   overlay-scrollbar layouts. Older browsers keep a stable vertical scrollbar. */
html{overflow-y:scroll}
@supports(scrollbar-gutter:stable both-edges){
 @media(min-width:761px){html{overflow-y:auto;scrollbar-gutter:stable both-edges}}
}

/* Equal day areas keep a compact two-line preview; opening the day shows all text.
   Only actual Sunday–Monday boundaries have a visible rule. */
.calendar .month-half{border:0;min-width:0}
.calendar .day{border:0;grid-template-columns:28px minmax(0,1fr) auto;gap:10px;min-height:48px;padding:6px 8px}
.calendar .day-events{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;max-height:3em;overflow:hidden;line-height:1.5}
.calendar .day-event{display:inline}
.calendar .day-separator{color:var(--muted)}
.calendar .day-count{display:block;white-space:nowrap;font-size:12px;line-height:1.75;color:var(--muted);padding-top:1px}
.calendar .day.week-end{border-bottom:2px solid var(--line)}
.calendar .month-half.week-start>.day:first-child{border-top:2px solid var(--line)}
@media(min-width:761px){
 .calendar-page .calendar{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(15,minmax(48px,1fr));gap:0 28px;align-items:stretch}
 .calendar-page .calendar:has(.month-half>.day:nth-child(16)){grid-template-rows:repeat(16,minmax(48px,1fr))}
 .calendar .month-half{display:grid;grid-row:1/-1;grid-template-columns:minmax(0,1fr);grid-template-rows:subgrid;row-gap:0}
}
@media(max-width:760px){
 .calendar-page .calendar{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-auto-rows:minmax(48px,1fr);gap:0;align-items:stretch}
 .calendar .day{padding-inline:4px}
 .calendar .month-half{display:contents}
 /* The stacked second half shares Sunday's existing bottom rule. */
 .calendar .month-half+.month-half.week-start>.day:first-child{border-top:0}
}

/* Reminder rows are separate from the day grid and retain full text and details. */
.calendar-reminder-row{display:grid;grid-template-columns:220px minmax(0,1fr);gap:8px 16px;align-items:start;min-height:48px}
.calendar-reminder-date{font-size:13px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}
.calendar-reminder-text{display:grid;gap:5px;min-width:0;overflow-wrap:anywhere}
.calendar-reminder-note{font-size:12px;color:var(--muted)}
.calendar-reminder-history{margin-top:16px}
.calendar-reminder-history>summary{cursor:pointer;min-height:44px;padding-block:10px;font-size:14px;color:var(--muted)}
@media(max-width:760px){.calendar-reminder-row{grid-template-columns:minmax(0,1fr);gap:5px}}
