/* Mama V3 — warm surfaces, clear posts, quiet semantic color. */
:root {
  color-scheme: light;
  --mama-bg: #f4f5f1;
  --mama-surface: #fff;
  --mama-surface-soft: #fafbf9;
  --mama-ink: #202720;
  --mama-muted: #778078;
  --mama-faint: #9aa29b;
  --mama-line: #e7ebe6;
  --mama-brand: #456e59;
  --mama-brand-soft: #e8f0e9;
  --mama-update: #6879ae;
  --mama-update-soft: #f0f2fb;
  --mama-observation: #54816a;
  --mama-observation-soft: #edf5ef;
  --mama-visit: #a47943;
  --mama-visit-soft: #faf3e8;
  --mama-phone: #8270a0;
  --mama-phone-soft: #f4f0f8;
  --mama-care: #4f8292;
  --mama-care-soft: #edf5f7;
  --mama-document: #77728e;
  --mama-document-soft: #f3f2f7;
  --mama-event: #ab705e;
  --mama-event-soft: #faf1ed;
  --mama-positive: #47765c;
  --mama-positive-soft: #f0f6f1;
  --mama-negative: #a56e59;
  --mama-negative-soft: #fcf4ef;
  --mama-shadow-card: 0 2px 6px rgb(32 48 37 / 3%), 0 10px 28px rgb(32 48 37 / 3%);
  --mama-shadow-raised: 0 16px 48px rgb(24 38 29 / 14%);
  --mama-radius-card: 24px;
  --mama-ease: cubic-bezier(.2,.75,.25,1);
  --mama-fast: 180ms;
  --mama-normal: 240ms;
  --mama-feed-width: 790px;
}
html { background:var(--mama-bg); scroll-behavior:smooth; }
body { background:var(--mama-bg); color:var(--mama-ink); font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display",system-ui,sans-serif; }
body:has(.timeline-layout) { min-height:100vh; }
.agenda-bar { position:sticky; z-index:30; top:0; height:66px; padding:0 max(28px,calc((100vw - 1280px)/2)); display:flex; align-items:center; justify-content:space-between; background:rgb(248 249 246 / 86%); border-bottom:1px solid rgb(223 229 222 / 75%); backdrop-filter:blur(20px) saturate(1.3); -webkit-backdrop-filter:blur(20px) saturate(1.3); }
.agenda-brand { display:inline-flex; align-items:center; gap:10px; color:var(--mama-ink); font-size:20px; font-weight:700; letter-spacing:-.045em; text-decoration:none; }
.brand-mark { width:30px; height:30px; display:grid; place-items:center; border-radius:11px; color:#fff; background:linear-gradient(145deg,#63866e,#42634e); box-shadow:inset 0 1px rgb(255 255 255 / 35%),0 3px 8px rgb(54 84 62 / 20%); font-family:Georgia,serif; font-size:20px; font-style:italic; line-height:1; }
.header-actions { display:flex; align-items:center; gap:8px; }
.header-search,.agenda-menu>summary { width:42px; height:42px; display:grid; place-items:center; color:#667168; text-decoration:none; border:0; border-radius:14px; background:transparent; cursor:pointer; transition:background var(--mama-fast) var(--mama-ease),transform var(--mama-fast) var(--mama-ease); }
.header-search:hover,.agenda-menu>summary:hover { background:#e9ede8; }
.header-search svg { width:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
.layout-toggle { width:42px; height:42px; display:grid; place-items:center; padding:0; border:0; border-radius:14px; color:#667168; background:transparent; cursor:pointer; }
.layout-toggle:hover { background:#e9ede8; }
.layout-toggle svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.layout-toggle [data-mode="desktop"] [data-mobile-icon],.layout-toggle [data-mode="mobile"] [data-desktop-icon] { display:none; }
.agenda-menu { position:relative; }
.agenda-menu>summary { list-style:none; display:flex; align-items:center; justify-content:center; gap:3px; }
.agenda-menu>summary::-webkit-details-marker { display:none; }
.agenda-menu>summary span { width:4px; height:4px; border-radius:50%; background:#667168; }
.agenda-menu-pop { position:absolute; top:calc(100% + 9px); right:0; z-index:50; width:230px; padding:7px; border:1px solid rgb(225 230 224 / 90%); border-radius:17px; background:rgb(255 255 255 / 96%); box-shadow:var(--mama-shadow-raised); backdrop-filter:blur(18px); }
.agenda-menu-pop a,.agenda-menu-pop button { width:100%; min-height:42px; display:flex; align-items:center; padding:0 12px; border:0; border-radius:11px; background:none; color:var(--mama-ink); text-align:left; text-decoration:none; font:inherit; font-size:14px; cursor:pointer; }
.agenda-menu-pop a:hover,.agenda-menu-pop button:hover { background:#f1f4f0; }
.agenda-menu-pop form { margin:5px 0 0; padding-top:5px; border-top:1px solid var(--mama-line); }
.shell.agenda-shell { width:100%; max-width:none; margin:0; padding:34px 32px 100px; }
.timeline-layout { display:grid; grid-template-columns:minmax(0,var(--mama-feed-width)) 294px; gap:44px; align-items:start; justify-content:center; max-width:1210px; margin:0 auto; }
.agenda-feed { position:relative; min-width:0; }
.feed-sentinel { position:absolute; top:0; left:0; width:1px; height:1px; pointer-events:none; }
.agenda-day { position:relative; z-index:3; display:flex; align-items:center; gap:14px; margin:20px 0 13px; color:#667269; font-size:12px; font-weight:650; letter-spacing:.015em; line-height:1.2; text-transform:none; }
.agenda-day::before,.agenda-day::after { content:""; height:1px; flex:1; background:linear-gradient(90deg,transparent,#dfe5df); }
.agenda-day::after { background:linear-gradient(90deg,#dfe5df,transparent); }
.agenda-day span { padding:7px 12px; border:1px solid #e5eae4; border-radius:999px; background:#f8f9f6; white-space:nowrap; }
.post-card { --post-accent:var(--mama-brand); --post-tint:var(--mama-brand-soft); position:relative; margin:0 0 15px; padding:20px 22px 18px; overflow:hidden; border:1px solid rgb(225 231 224 / 92%); border-radius:var(--mama-radius-card); background:var(--mama-surface); box-shadow:var(--mama-shadow-card); transition:transform var(--mama-fast) var(--mama-ease),box-shadow var(--mama-fast) var(--mama-ease),border-color var(--mama-fast) var(--mama-ease); }
.post-card::before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background:var(--post-accent); opacity:.56; }
.post-card:hover { transform:translateY(-1px); border-color:#d8e1d9; box-shadow:0 4px 10px rgb(32 48 37 / 4%),0 14px 34px rgb(32 48 37 / 6%); }
.post-card:active { transform:scale(.998); }
.post-card[data-kind="update"] { --post-accent:var(--mama-update); --post-tint:var(--mama-update-soft); }
.post-card[data-kind="observation"] { --post-accent:var(--mama-observation); --post-tint:var(--mama-observation-soft); }
.post-card[data-kind="visit"] { --post-accent:var(--mama-visit); --post-tint:var(--mama-visit-soft); }
.post-card[data-kind="phone"] { --post-accent:var(--mama-phone); --post-tint:var(--mama-phone-soft); }
.post-card[data-kind="care"] { --post-accent:var(--mama-care); --post-tint:var(--mama-care-soft); }
.post-card[data-kind="document"] { --post-accent:var(--mama-document); --post-tint:var(--mama-document-soft); }
.post-card[data-kind="event"] { --post-accent:var(--mama-event); --post-tint:var(--mama-event-soft); }
.post-heading { display:flex; align-items:center; gap:11px; min-height:42px; }
.author-avatar { width:41px; height:41px; flex:0 0 41px; display:grid; place-items:center; border:1px solid rgb(255 255 255 / 90%); border-radius:50%; color:#435e4a; background:linear-gradient(145deg,#e2eee4,#cbdccc); box-shadow:0 0 0 1px rgb(76 106 81 / 13%),0 2px 5px rgb(34 51 39 / 7%); font-size:15px; font-weight:700; }
.avatar-sarah { color:#625b83; background:linear-gradient(145deg,#eee9f7,#dcd5ec); box-shadow:0 0 0 1px rgb(107 90 143 / 12%),0 2px 5px rgb(34 51 39 / 6%); }
.avatar-cedric { color:#42674f; background:linear-gradient(145deg,#e5efe5,#cedfcf); }
.avatar-matthias { color:#4e708c; background:linear-gradient(145deg,#e6f0f7,#d0dfeb); }
.avatar-valentine { color:#986d57; background:linear-gradient(145deg,#fbede3,#f0d9ca); }
.avatar-sophie { color:#985f75; background:linear-gradient(145deg,#f7e8ee,#efd3df); }
.avatar-other { color:#676e68; background:linear-gradient(145deg,#eef0ed,#dfe3de); }
.post-author { min-width:0; display:flex; flex-direction:column; gap:2px; }
.post-author strong { overflow:hidden; color:#29332b; font-size:14px; font-weight:650; letter-spacing:-.01em; text-overflow:ellipsis; white-space:nowrap; }
.post-time { color:var(--mama-muted); font-size:12px; font-variant-numeric:tabular-nums; line-height:1.3; }
.type-pill { --pill-color:var(--mama-brand); --pill-bg:var(--mama-brand-soft); display:inline-flex; align-items:center; gap:6px; flex:0 0 auto; min-height:27px; margin-left:auto; padding:0 10px; border:1px solid color-mix(in srgb,var(--pill-color) 14%,transparent); border-radius:999px; color:var(--pill-color); background:var(--pill-bg); font-size:11px; font-weight:650; line-height:1; white-space:nowrap; }
.type-pill svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.type-pill.type-update { --pill-color:var(--mama-update); --pill-bg:var(--mama-update-soft); }
.type-pill.type-observation { --pill-color:var(--mama-observation); --pill-bg:var(--mama-observation-soft); }
.type-pill.type-visit { --pill-color:var(--mama-visit); --pill-bg:var(--mama-visit-soft); }
.type-pill.type-phone { --pill-color:var(--mama-phone); --pill-bg:var(--mama-phone-soft); }
.type-pill.type-care { --pill-color:var(--mama-care); --pill-bg:var(--mama-care-soft); }
.type-pill.type-document { --pill-color:var(--mama-document); --pill-bg:var(--mama-document-soft); }
.type-pill.type-event { --pill-color:var(--mama-event); --pill-bg:var(--mama-event-soft); }
.post-content { margin:14px 0 0 52px; border-radius:12px; cursor:pointer; outline:none; }
.post-content:focus-visible { box-shadow:0 0 0 3px rgb(78 124 91 / 24%); }
.post-title { margin:0 0 7px; color:#3b4840; font-size:14px; font-weight:620; letter-spacing:-.01em; }
.post-context { margin:0 0 8px; color:#758078; font-size:12px; font-weight:560; }
.post-context span { color:#929a94; font-weight:450; }
.post-main-text { margin-top:0 !important; }
.post-text { margin:0; color:#303a33; font-size:15.5px; font-weight:420; line-height:1.58; letter-spacing:-.006em; white-space:pre-wrap; overflow-wrap:anywhere; }
.post-clamp { display:-webkit-box; overflow:hidden; -webkit-box-orient:vertical; -webkit-line-clamp:6; }
.post-section { margin:12px 0 0; padding:11px 13px 12px; border:1px solid transparent; border-radius:15px; }
.post-section h3 { display:flex; align-items:center; gap:7px; margin:0 0 4px; color:#607067; font-size:10px; font-weight:750; letter-spacing:.075em; text-transform:uppercase; }
.post-section .post-text { color:#344239; font-size:14.5px; line-height:1.53; }
.post-positive { border-color:#e3eee5; background:var(--mama-positive-soft); }
.post-positive h3 { color:var(--mama-positive); }
.post-negative { border-color:#f2e5de; background:var(--mama-negative-soft); }
.post-negative h3 { color:var(--mama-negative); }
.semantic-icon { width:16px; height:16px; display:inline-grid; place-items:center; border-radius:50%; background:rgb(255 255 255 / 75%); font-size:11px; letter-spacing:0; }
.score-indicator { display:flex; align-items:flex-end; justify-content:space-between; gap:14px; margin-top:13px; padding:10px 12px; border:1px solid #e9ede8; border-radius:14px; background:#fafbf9; }
.score-indicator>div { display:flex; align-items:baseline; gap:9px; }
.score-indicator>div span { color:#768078; font-size:11px; }
.score-indicator strong { color:#496f55; font-size:17px; font-weight:720; font-variant-numeric:tabular-nums; }
.score-indicator strong small { margin-left:2px; color:#9aa39b; font-size:10px; font-weight:550; }
.score-dots { display:flex; align-items:center; gap:3px; padding-bottom:3px; }
.score-dots i { width:8px; height:5px; border-radius:9px; background:#dfe5df; }
.score-dots i.is-filled { background:#82a189; }
.post-seen { margin:12px 0 0 52px; color:#9aa29b; font-size:10px; }
.proposal-chip { display:inline-flex; align-items:center; gap:5px; flex:0 0 auto; margin-left:auto; padding:5px 8px; border:1px dashed #d4caa9; border-radius:999px; color:#88794e; background:#faf8f0; font-size:10px; font-weight:650; white-space:nowrap; }
.feed-import-preview .type-pill { margin-left:0; }
.feed-import-preview .proposal-chip { margin-left:auto; }
.preview-notice { display:flex; align-items:center; gap:10px; margin:0 0 15px; padding:9px 12px; border:1px solid #ece6d6; border-radius:14px; color:#756f5b; background:#fbfaf5; font-size:11px; }
.preview-notice .proposal-chip { margin-left:0; }
.preview-notice>a { margin-left:auto; color:#677e68; font-weight:650; text-decoration:none; white-space:nowrap; }
.preview-notice>a span { margin-left:3px; }
.diary-sidebar { position:sticky; top:88px; display:flex; flex-direction:column; gap:13px; padding:17px; border:1px solid rgb(255 255 255 / 80%); border-radius:24px; background:rgb(255 255 255 / 74%); box-shadow:0 9px 30px rgb(38 53 41 / 4%); backdrop-filter:blur(14px) saturate(1.2); -webkit-backdrop-filter:blur(14px) saturate(1.2); }
.context-block { padding:2px 2px 13px; border-bottom:1px solid var(--mama-line); }
.context-block:last-child { padding-bottom:0; border-bottom:0; }
.context-label { margin:0 0 9px; color:#879188; font-size:10px; font-weight:760; letter-spacing:.1em; }
.context-kicker { margin:0 0 6px; color:#727d74; font-size:11px; line-height:1.5; }
.context-copy { display:-webkit-box; margin:0; overflow:hidden; color:#344037; font-size:13px; line-height:1.52; -webkit-line-clamp:4; -webkit-box-orient:vertical; }
.context-link { display:inline-flex; align-items:center; gap:6px; margin-top:9px; padding:0; border:0; color:var(--mama-brand); background:none; font:inherit; font-size:11px; font-weight:680; text-decoration:none; cursor:pointer; }
.recent-authors { display:flex; flex-wrap:wrap; gap:6px; }
.recent-authors span { padding:5px 9px; border:1px solid #e8ece7; border-radius:999px; color:#647068; background:#f7f9f6; font-size:10px; }
.sidebar-report { display:flex; flex-direction:column; gap:5px; padding:13px 14px; border:1px solid #e2ebe3; border-radius:16px; color:inherit; background:linear-gradient(135deg,#f5f9f5,#edf4ed); text-decoration:none; transition:transform var(--mama-fast) var(--mama-ease),background var(--mama-fast) var(--mama-ease); }
.sidebar-report:hover { transform:translateY(-1px); background:#edf5ee; }
.sidebar-report>span { color:#7d887f; font-size:10px; }
.sidebar-report b { display:flex; justify-content:space-between; color:#466a50; font-size:13px; font-weight:650; }
.sidebar-links { display:grid; gap:2px; }
.sidebar-links a { display:flex; justify-content:space-between; align-items:center; min-height:36px; padding:0 8px; border-radius:9px; color:#626e65; font-size:12px; text-decoration:none; }
.sidebar-links a:hover { background:#f1f4f0; }
.sidebar-links a span { color:#9aa29b; font-size:17px; }
.floating-add { position:fixed; z-index:25; right:max(34px,calc((100vw - 1210px)/2 + 320px)); bottom:28px; width:58px; height:58px; display:grid; place-items:center; border:1px solid rgb(255 255 255 / 35%); border-radius:21px; color:white; background:linear-gradient(145deg,#5b8064,#3f674c); box-shadow:0 9px 22px rgb(50 83 57 / 26%),inset 0 1px rgb(255 255 255 / 24%); font-size:30px; font-weight:350; line-height:1; cursor:pointer; transition:transform var(--mama-fast) var(--mama-ease),box-shadow var(--mama-fast) var(--mama-ease); }
.floating-add:hover { transform:translateY(-2px) rotate(2deg); box-shadow:0 12px 28px rgb(50 83 57 / 30%),inset 0 1px rgb(255 255 255 / 24%); }
.floating-add:active { transform:scale(.95); }
.newer-button { position:fixed; z-index:24; left:50%; bottom:30px; transform:translateX(-50%); min-height:42px; padding:0 16px; border:1px solid #dce8de; border-radius:999px; color:#41694c; background:rgb(250 253 250 / 94%); box-shadow:0 7px 20px rgb(35 55 39 / 12%); font:inherit; font-size:12px; font-weight:650; cursor:pointer; backdrop-filter:blur(10px); }
.newer-button[hidden] { display:none; }
.feed-loading,.feed-end { color:#9aa29b; text-align:center; font-size:11px; }
.agenda-empty { margin:72px auto; text-align:center; }
.agenda-empty .empty-mark { color:#77947a; font-size:32px; }
.agenda-empty h1 { margin:10px 0 5px; font-size:21px; letter-spacing:-.03em; }
.agenda-empty p { color:var(--mama-muted); font-size:14px; }
.empty-add { min-height:44px; padding:0 16px; border:0; border-radius:13px; color:white; background:var(--mama-brand); font:inherit; cursor:pointer; }
/* Existing dialogs retain their behavior while receiving the same V3 surface language. */
.entry-overlay,.bottom-sheet { border:1px solid rgb(255 255 255 / 65%); border-radius:26px; background:#fff; box-shadow:var(--mama-shadow-raised); }
.entry-overlay::backdrop,.bottom-sheet::backdrop { background:rgb(23 32 25 / 36%); backdrop-filter:blur(4px); }
.entry-overlay[open] { animation:sheet-in var(--mama-normal) var(--mama-ease) both; }
.entry-overlay[open] { position:fixed; inset:50% auto auto 50%; transform:translate(-50%,-50%); height:auto; max-height:88dvh; overflow:hidden; }
.entry-overlay[open]>.overlay-content { height:auto; max-height:88dvh; }
.entry-overlay[open] .detail-sheet { height:auto; max-height:88dvh; display:block; overflow:hidden; border-radius:inherit; }
.entry-overlay[open] .sheet-head { padding:24px 30px 17px; }
.entry-overlay[open] .sheet-head h2 { margin:4px 0 5px; color:#27312a; font-size:21px; letter-spacing:-.035em; }
.entry-overlay[open] .sheet-author { font-size:14px; }
.entry-overlay[open] .detail-date { color:#8a948b; font-size:12px; }
.entry-overlay[open] .detail-scroll { max-height:calc(88dvh - 120px); padding:10px 30px 27px; overflow:auto; overscroll-behavior:contain; }
.entry-overlay[open] .detail-copy { margin:19px 0; }
.entry-overlay[open] .detail-copy h3 { color:#7e897f; }
.entry-overlay[open] .detail-copy p { color:#303a33; font-size:15px; line-height:1.72; }
@keyframes sheet-in { from { opacity:0; transform:translate(-50%,-48%) scale(.985); } to { opacity:1; transform:translate(-50%,-50%) scale(1); } }
@keyframes mobile-sheet-in { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.overlay-content { position:relative; }
.icon-close,[data-overlay-close] { width:44px; height:44px; display:grid; place-items:center; border:0; border-radius:14px; color:#5e6960; background:#f1f4f1; font-size:24px; cursor:pointer; }
.floating-add:focus-visible,.agenda-menu summary:focus-visible,.header-search:focus-visible,.post-content:focus-visible,.sidebar-links a:focus-visible { outline:3px solid #88a98e; outline-offset:3px; }
.add-choice { min-height:53px; gap:10px; border-color:#edf0ec; color:#354039; font-size:14px; font-weight:540; text-decoration:none; }
.choice-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:12px; color:#5d7863; background:#eef4ee; }
.choice-icon svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.add-choice:nth-child(2) .choice-icon { color:#6b79aa; background:#f0f2fb; }
.add-choice:nth-child(3) .choice-icon { color:#9c7747; background:#faf3e8; }
.add-choice:nth-child(4) .choice-icon { color:#81709c; background:#f3eff8; }
.add-choice:nth-child(5) .choice-icon { color:#4f8292; background:#edf5f7; }
.add-choice:nth-child(6) .choice-icon { color:#77728e; background:#f3f2f7; }
.mobile-preview { min-height:calc(100dvh - 66px); display:flex; flex-direction:column; align-items:center; gap:19px; padding:20px; background:radial-gradient(ellipse at 50% 20%,#e8ece6 0,#e2e7e0 43%,#dce2da 100%); }
.preview-toolbar { width:min(100%,760px); display:flex; align-items:center; justify-content:space-between; gap:20px; color:#4d5a50; font-size:12px; }
.preview-toolbar>div { display:flex; align-items:center; gap:7px; }
.preview-toolbar a { min-height:34px; display:inline-flex; align-items:center; padding:0 11px; border:1px solid #d2dad1; border-radius:11px; color:#58655a; background:rgb(255 255 255 / 60%); font-size:11px; text-decoration:none; }
.preview-toolbar a.selected { border-color:#a9beaa; color:#41634a; background:#f7faf6; font-weight:700; }
.preview-device { width:calc(var(--preview-width) + 14px); height:calc(var(--preview-height) + 14px); flex:0 0 auto; overflow:hidden; border:7px solid #29302c; border-radius:38px; background:var(--mama-bg); box-shadow:0 28px 70px rgb(28 39 30 / 28%),0 3px 8px rgb(28 39 30 / 18%); }
.preview-device iframe { width:100%; height:100%; display:block; border:0; background:var(--mama-bg); }
@media (min-width:701px) {
  .add-sheet[open] { position:fixed; inset:auto max(34px,calc((100vw - 1210px)/2 + 320px)) 96px auto; width:min(360px,calc(100vw - 40px)); max-width:none; max-height:calc(100dvh - 125px); overflow:auto; margin:0; padding:15px 15px 17px; border:1px solid #e4eae3; border-radius:22px; box-shadow:0 22px 60px rgb(24 38 29 / 18%); animation:popover-in var(--mama-fast) var(--mama-ease) both; }
  .add-sheet::backdrop { background:rgb(23 32 25 / 8%); backdrop-filter:none; }
  .add-sheet .sheet-grabber { display:none; }
  .add-sheet .sheet-dismiss { position:absolute; top:9px; right:9px; z-index:2; height:auto; }
  .add-sheet .sheet-dismiss button { position:static; transform:none; width:36px; height:36px; border-radius:12px; font-size:21px; }
  .add-sheet h2 { margin:0 40px 8px 1px; font-size:18px; }
  .add-choice { min-height:45px; }
  .choice-icon { width:31px; height:31px; border-radius:11px; }
  .more-choices>summary { min-height:44px; }
  .more-choices .add-choice { min-height:41px; }
}
@keyframes popover-in { from { opacity:0; transform:translateY(5px) scale(.99); } to { opacity:1; transform:translateY(0) scale(1); } }
@media (max-width:1199px) {
  .shell.agenda-shell { padding:25px 24px 100px; }
  .timeline-layout { grid-template-columns:minmax(0,1fr); max-width:840px; }
  .diary-sidebar { position:static; display:grid; grid-template-columns:1fr 1fr; }
  .diary-sidebar .sidebar-report,.diary-sidebar .sidebar-links { align-self:start; }
  .floating-add { right:27px; }
  .add-sheet[open] { right:27px; }
}
@media (max-width:700px) {
  html,body { width:100%; min-width:0; overflow-x:hidden; }
  .agenda-bar { position:fixed; inset:0 0 auto; height:calc(57px + env(safe-area-inset-top)); padding:env(safe-area-inset-top) 15px 0; }
  .agenda-brand { gap:8px; font-size:18px; }
  .brand-mark { width:27px; height:27px; border-radius:10px; font-size:18px; }
  .header-search,.layout-toggle { display:none; }
  .agenda-menu>summary { width:40px; height:42px; }
  .shell.agenda-shell { padding:calc(69px + env(safe-area-inset-top)) 12px calc(94px + env(safe-area-inset-bottom)); }
  .timeline-layout { display:block; width:100%; }
  .diary-sidebar { display:none; }
  .agenda-day { gap:10px; margin:13px 0 10px; font-size:10px; letter-spacing:.08em; }
  .agenda-day span { padding:6px 10px; }
  .post-card { margin-bottom:12px; padding:16px 15px 15px; border-radius:20px; }
  .post-card::before { width:3px; }
  .post-heading { gap:10px; min-height:41px; }
  .author-avatar { width:40px; height:40px; flex-basis:40px; font-size:14px; }
  .post-author strong { font-size:14px; }
  .type-pill { min-height:26px; gap:5px; padding:0 8px; font-size:10px; }
  .type-pill svg { width:13px; height:13px; }
  .post-content { margin:12px 0 0 50px; }
  .post-text { font-size:15px; line-height:1.55; }
  .post-clamp { -webkit-line-clamp:5; }
  .post-section { margin-top:10px; padding:10px 11px 11px; border-radius:13px; }
  .post-section .post-text { font-size:14px; }
  .post-seen { margin-left:50px; }
  .entry-overlay[open] { inset:0; transform:none; width:100%; height:100dvh; max-height:100dvh; border:0; border-radius:0; animation:mobile-sheet-in var(--mama-normal) var(--mama-ease) both; }
  .entry-overlay[open]>.overlay-content,.entry-overlay[open] .detail-sheet { height:100%; max-height:100%; }
  .entry-overlay[open] .detail-sheet { display:grid; grid-template-rows:auto minmax(0,1fr); }
  .entry-overlay[open] .sheet-head { padding:calc(18px + env(safe-area-inset-top)) 18px 14px; }
  .entry-overlay[open] .detail-scroll { max-height:none; padding:10px 20px calc(30px + env(safe-area-inset-bottom)); }
  .score-indicator { margin-top:11px; }
  .preview-notice { gap:8px; padding:8px 9px; font-size:10px; }
  .preview-notice .proposal-chip { padding:4px 6px; font-size:9px; }
  .preview-notice>a { font-size:10px; }
  .floating-add { right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); width:58px; height:58px; border-radius:20px; }
  .newer-button { bottom:calc(23px + env(safe-area-inset-bottom)); }
  .agenda-menu-pop { top:calc(57px + env(safe-area-inset-top)); right:-5px; width:min(250px,calc(100vw - 24px)); }
  .mobile-preview { min-height:calc(100dvh - 57px); padding:12px 8px; }
  .preview-toolbar { width:100%; justify-content:center; flex-wrap:wrap; gap:10px; }
  .preview-toolbar strong { display:none; }
  .preview-device { width:calc(var(--preview-width) + 10px); height:calc(var(--preview-height) + 10px); max-width:calc(100vw - 16px); border-width:5px; border-radius:32px; }
}
@media (max-width:390px) {
  .shell.agenda-shell { padding-right:10px; padding-left:10px; }
  .post-card { padding-right:13px; padding-left:13px; }
  .type-pill { max-width:46%; overflow:hidden; text-overflow:ellipsis; }
  .proposal-chip { padding:4px 6px; font-size:9px; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}

/* Secondary material stays at the end of a post, away from its story text. */
.post-resource-footer { display:flex; align-items:center; flex-wrap:wrap; gap:7px 15px; margin:14px 0 0 50px; padding:11px 0 0; border-top:1px solid var(--mama-line,#e8e9e4); }
.resource-action { display:inline-flex; align-items:center; gap:7px; min-height:36px; padding:0 8px; border:0; border-radius:10px; background:transparent; color:var(--mama-muted,#73786f); font-family:inherit; font-size:12px; font-weight:600; line-height:1.2; cursor:pointer; transition:background .16s ease,color .16s ease; }
.resource-action:hover,.resource-action:focus-visible { background:#f0f3ef; color:var(--mama-brand,#45694e); outline:none; }
.resource-action:focus-visible { box-shadow:0 0 0 3px rgb(75 117 85 / 20%); }
.resource-action-icon { width:17px; height:17px; display:inline-grid; place-items:center; color:#718477; }
.resource-icon { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.resource-proposal { margin-left:auto; }
.detail-resource-section,.detail-source-section { margin-top:24px; padding-top:18px; border-top:1px solid var(--mama-line,#e8e9e4); scroll-margin-top:12px; }
.detail-resource-section>h3,.detail-source-section>h3 { margin:0 0 12px; color:#747b72; font-size:11px; font-weight:750; letter-spacing:.12em; text-transform:uppercase; }
.detail-resource-row { display:flex; align-items:flex-start; gap:12px; padding:12px 0; }
.detail-resource-row+.detail-resource-row { border-top:1px solid #eff0eb; }
.detail-resource-row>.resource-action-icon { width:38px; height:38px; flex:0 0 38px; border-radius:13px; background:#f0f3ef; }
.detail-resource-row>div { min-width:0; display:grid; gap:4px; }
.detail-resource-row strong { color:var(--mama-text,#28322b); font-size:14px; font-weight:650; overflow-wrap:anywhere; }
.detail-resource-row code { color:#73786f; font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere; }
.detail-resource-row small,.detail-source-section p { color:#777d75; font-size:12px; line-height:1.5; }
.detail-resource-row a { display:inline-flex; align-items:center; gap:4px; width:max-content; min-height:40px; color:#41684a; font-size:13px; font-weight:650; text-decoration:none; }
.detail-resource-row a:hover { text-decoration:underline; }
.detail-source-section p { margin:0; }
.detail-resource-section:focus { outline:none; }
.feed-import-preview .post-resource-footer { margin-left:50px; }
@media (max-width:700px) {
  .post-resource-footer,.feed-import-preview .post-resource-footer { margin-left:50px; gap:4px 9px; padding-top:8px; }
  .resource-action { min-height:38px; padding:0 6px; font-size:11px; }
  .resource-proposal { margin-left:auto; }
  .detail-resource-row { padding:10px 0; }
}
/* Date labels stay between posts; the compact sticky header tracks the visible day. */
.mobile-header-date { display:none; color:#737e75; font-size:12px; font-weight:590; font-variant-numeric:tabular-nums; white-space:nowrap; transition:opacity 160ms ease,transform 160ms ease; }
.mobile-header-date.date-changing { opacity:.38; transform:translateY(-2px); }
.agenda-day { position:relative; top:auto; z-index:auto; background:transparent; -webkit-backdrop-filter:none; backdrop-filter:none; }
.report-progress { display:grid; gap:5px; padding:12px 13px; border-radius:14px; color:#526a56; background:#f1f5ef; font-size:13px; }
.report-progress span { color:#7c877d; font-size:11px; line-height:1.5; }
.report-actions { display:flex; flex-wrap:wrap; gap:9px; margin:18px 0; }
.team-add { margin:8px 0 28px; }
.team-add>summary { display:inline-flex; min-height:44px; align-items:center; color:#496b50; font-size:13px; font-weight:650; cursor:pointer; }
.team-add .form-panel { margin-top:10px; }
.team-service { margin:30px 0 35px; }
.team-service>h2 { margin:0 0 12px; color:#727e73; font-size:11px; font-weight:750; letter-spacing:.1em; text-transform:uppercase; }
.team-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.team-doctor { display:grid; grid-template-columns:38px minmax(0,1fr) 16px; gap:11px; align-items:start; padding:15px; border:1px solid #e6ebe5; border-radius:17px; background:rgb(255 255 255 / 82%); box-shadow:0 4px 14px rgb(40 58 43 / 3%); transition:transform 150ms ease,box-shadow 150ms ease; }
.team-doctor:hover { transform:translateY(-1px); box-shadow:0 8px 20px rgb(40 58 43 / 7%); }
.team-doctor-mark { display:grid; place-items:center; width:38px; height:38px; border-radius:13px; color:#4d6d53; background:#eef4ed; font-weight:700; }
.team-doctor-main { min-width:0; display:grid; gap:4px; }
.team-doctor-main>b { color:#303b32; font-size:13px; line-height:1.35; }
.team-doctor-main>small,.team-contact-preview { color:#828c83; font-size:11px; line-height:1.45; }
.team-contact-count { color:#54755a; font-size:11px; font-weight:650; }
.team-contact-preview { display:flex; gap:8px; min-width:0; }
.team-contact-preview time { flex:0 0 auto; color:#7a857b; }
.team-chevron { align-self:center; color:#a2aaa2; font-size:20px; }
.team-history { margin-top:25px; }
.team-history>h2 { display:flex; gap:9px; align-items:center; font-size:16px; }
.team-history>h2 span { color:#7b877d; font-size:12px; font-weight:500; }
.team-history-row { display:grid; grid-template-columns:145px minmax(0,1fr); gap:15px; padding:16px 0; border-top:1px solid #e6eae4; }
.team-history-row>time { color:#7a857c; font-size:12px; }
.team-history-row>div { display:grid; gap:4px; }
.team-history-row b { color:#313b33; font-size:14px; }
.team-history-row small,.team-history-row a { color:#79847a; font-size:12px; }
.team-history-row a { color:#4d7555; }
@media(max-width:700px) { .team-grid{grid-template-columns:1fr}.team-doctor{padding:13px;border-radius:15px}.team-history-row{grid-template-columns:95px minmax(0,1fr);gap:9px} }
@media print { body{background:white!important}.agenda-bar,.report-form,.report-panel-head,.report-actions,.report-sources,.floating-add{display:none!important}.report-overlay{position:static!important;display:block!important;inset:auto!important;width:100%!important;height:auto!important;max-height:none!important;overflow:visible!important;border:0!important;box-shadow:none!important}.generated-report{font-size:11pt!important;color:black!important} }
@media(max-width:700px) {
  .agenda-bar { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(40px,1fr); column-gap:8px; position:fixed; inset:0 0 auto; height:calc(57px + env(safe-area-inset-top)); padding:env(safe-area-inset-top) 12px 0; }
  .agenda-brand { min-width:0; }
  .mobile-header-date { display:block; justify-self:center; max-width:36vw; overflow:hidden; text-overflow:ellipsis; }
  .header-actions { justify-self:end; }
  .agenda-day { position:relative; top:auto; z-index:auto; margin:14px 0 12px; padding:0; background:none; -webkit-backdrop-filter:none; backdrop-filter:none; }
  .agenda-day span { background:var(--mama-bg); }
  .post-card { cursor:pointer; }
}

/* Compact date rail and event chronology */
.date-rail { position:sticky; z-index:29; top:66px; display:flex; align-items:center; gap:8px; width:min(790px,calc(100% - 40px)); height:58px; margin:0 auto; padding:4px 7px; border:1px solid rgb(228 233 226 / 86%); border-radius:19px; background:rgb(248 249 246 / 94%); box-shadow:0 6px 22px rgb(39 54 41 / 5%); backdrop-filter:blur(18px) saturate(1.2); }
.date-rail-track { display:flex; align-items:center; justify-content:center; gap:5px; flex:1; min-width:0; height:100%; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:none; scroll-snap-type:x mandatory; }
.date-rail-track::-webkit-scrollbar { display:none; }
.date-chip { position:relative; display:flex; flex:1 0 54px; flex-direction:column; justify-content:center; align-items:center; gap:1px; max-width:82px; min-width:42px; height:46px; padding:3px 5px; border:1px solid transparent; border-radius:14px; color:#667269; background:transparent; font:inherit; scroll-snap-align:center; cursor:pointer; transition:color .16s ease,background .16s ease,transform .16s ease; }
.date-chip>span { font-size:10px; font-weight:650; text-transform:capitalize; line-height:1; }
.date-chip>b { color:#313c33; font-size:15px; font-weight:650; font-variant-numeric:tabular-nums; line-height:1.15; }
.date-chip>small { position:absolute; right:4px; top:3px; color:#89948a; font-size:8px; line-height:1; }
.date-chip:hover { background:#eef3ed; }
.date-chip.is-active { border-color:#d9e7db; color:#386549; background:#e7f0e8; box-shadow:inset 0 1px rgb(255 255 255 / 90%),0 2px 6px rgb(46 83 57 / 7%); }
.date-chip.is-active>b { color:#315c3e; }
.date-chip:focus-visible,.date-step:focus-visible { outline:3px solid #90b298; outline-offset:2px; }
.date-step { width:31px; height:38px; flex:0 0 31px; border:0; border-radius:11px; color:#66776a; background:transparent; font:inherit; font-size:24px; line-height:1; cursor:pointer; }
.date-step:hover { background:#eaf0e9; }
.agenda-day { scroll-margin-top:145px; }
.post-card { display:grid; grid-template-columns:60px minmax(0,1fr); gap:12px; padding:16px 19px 15px 13px; }
.post-card::before { width:3px; opacity:.76; }
.entry-rail { position:relative; display:flex; flex-direction:column; align-items:center; gap:10px; padding-top:5px; }
.rail-time { color:#5f6c62; font-size:12px; font-weight:660; font-variant-numeric:tabular-nums; line-height:1.2; }
.event-symbol { position:relative; z-index:1; display:grid; place-items:center; width:34px; height:34px; border:1px solid color-mix(in srgb,var(--post-accent) 22%,white); border-radius:12px; color:var(--post-accent); background:var(--post-tint); }
.event-symbol svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.rail-stem { position:absolute; z-index:0; top:49px; bottom:-27px; left:50%; width:1px; background:linear-gradient(var(--post-accent),#e8ece7 80%); opacity:.34; }
.entry-main { min-width:0; }
.post-heading { gap:9px; min-height:38px; }
.author-avatar { width:34px; height:34px; flex-basis:34px; font-size:13px; }
.avatar-medical { color:#3e7181; background:linear-gradient(145deg,#e2f0f3,#cce1e4); box-shadow:0 0 0 1px rgb(54 112 127 / 17%),0 2px 5px rgb(34 51 39 / 6%); }
.post-author small { max-width:35vw; overflow:hidden; color:#79867c; font-size:10px; font-weight:520; text-overflow:ellipsis; white-space:nowrap; }
.post-content { margin:8px 0 0; }
.post-seen,.post-resource-footer { margin-left:0; }
.post-card[data-kind="investigation"] { --post-accent:#5479ad; --post-tint:#edf2fa; }
.post-card[data-kind="treatment"] { --post-accent:#3e847b; --post-tint:#eaf4f1; }
.post-card[data-kind="therapy"] { --post-accent:#548774; --post-tint:#edf5ef; }
.post-card[data-kind="admission"],.post-card[data-kind="discharge"] { --post-accent:#ad7456; --post-tint:#fbf1e9; }
.type-pill.type-investigation { --pill-color:#5479ad; --pill-bg:#edf2fa; }
.type-pill.type-treatment { --pill-color:#3e847b; --pill-bg:#eaf4f1; }
.type-pill.type-therapy { --pill-color:#548774; --pill-bg:#edf5ef; }
.type-pill.type-admission,.type-pill.type-discharge { --pill-color:#ad7456; --pill-bg:#fbf1e9; }
.header-search { display:grid; }
@media (max-width:700px) {
  .agenda-bar { grid-template-columns:minmax(0,1fr) auto minmax(64px,auto); column-gap:6px; }
  .agenda-brand { font-size:17px; }
  .brand-mark { display:none; }
  .mobile-header-date { max-width:31vw; font-size:12px; }
  .header-actions { display:flex; align-items:center; gap:1px; }
  .header-search { width:40px; height:42px; display:grid; place-items:center; border-radius:13px; color:#52675a; }
  .header-search svg { width:20px; height:20px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; }
  .layout-toggle { display:none; }
  .agenda-menu>summary { width:39px; height:42px; }
  .date-rail { position:fixed; top:calc(57px + env(safe-area-inset-top)); left:0; right:0; width:100%; height:56px; gap:5px; padding:4px 8px; border:0; border-bottom:1px solid #e3e9e2; border-radius:0; background:rgb(248 249 246 / 94%); box-shadow:0 5px 14px rgb(36 51 39 / 4%); }
  .date-rail-track { justify-content:center; gap:4px; }
  .date-chip { flex:0 0 clamp(43px,12vw,55px); height:44px; }
  .date-step { width:24px; flex-basis:24px; }
  .shell.agenda-shell { padding-top:calc(124px + env(safe-area-inset-top)); }
  .agenda-day { scroll-margin-top:calc(125px + env(safe-area-inset-top)); margin:16px 0 12px; }
  .post-card { grid-template-columns:53px minmax(0,1fr); gap:8px; margin-bottom:11px; padding:13px 12px 13px 9px; border-radius:18px; }
  .entry-rail { gap:8px; padding-top:5px; }
  .rail-time { font-size:10px; }
  .event-symbol { width:31px; height:31px; border-radius:11px; }
  .event-symbol svg { width:17px; height:17px; }
  .rail-stem { top:46px; bottom:-24px; }
  .post-heading { gap:8px; min-height:34px; }
  .author-avatar { width:31px; height:31px; flex-basis:31px; font-size:12px; }
  .post-author strong { font-size:13px; }
  .post-author small { max-width:29vw; font-size:9px; }
  .type-pill { min-height:25px; gap:4px; padding:0 6px; font-size:9px; }
  .type-pill svg { width:12px; height:12px; }
  .post-content { margin:8px 0 0; }
  .post-text { font-size:14.5px; line-height:1.54; }
  .post-section { margin-top:8px; padding:8px 9px; }
  .post-resource-footer,.post-seen { margin-left:0; }
}
@media (max-width:390px) {
  .post-card { grid-template-columns:48px minmax(0,1fr); gap:7px; padding-right:10px; }
  .entry-rail .event-symbol { width:29px; height:29px; }
  .post-heading { gap:6px; }
  .type-pill>span { max-width:76px; overflow:hidden; text-overflow:ellipsis; }
  .date-chip { flex-basis:43px; }
}
@media (prefers-reduced-motion:reduce) { .date-chip,.date-rail-track { scroll-behavior:auto; transition:none; } }

/* The horizontal rail is the single visible date navigator. Keep the day markers
   as one-pixel scroll anchors so the rail stays synchronized without interrupting
   the chronological reading flow with repeated date banners. */
.agenda-bar { grid-template-columns:minmax(0,1fr) auto; }
.header-actions { justify-self:end; }
.agenda-day { display:block!important; position:relative!important; top:auto!important; height:1px!important; min-height:1px!important; margin:0!important; padding:0!important; overflow:hidden!important; color:transparent!important; background:transparent!important; opacity:0!important; line-height:1px!important; letter-spacing:0!important; scroll-margin-top:132px; }
.agenda-day::before,.agenda-day::after,.agenda-day span { display:none!important; }
.post-clamp { -webkit-line-clamp:6; }
.search-refined { display:grid; gap:12px; padding:17px; border:1px solid #e5eae3; border-radius:19px; background:rgb(255 255 255 / 80%); }
.search-query-label { display:grid; gap:7px; color:#707b72; font-size:11px; font-weight:650; }
.search-query-label input,.search-filter-row select,.search-filter-row input { min-height:44px; padding:0 12px; border:1px solid #e2e8e1; border-radius:12px; color:#2d382f; background:#fbfcfa; font:inherit; font-size:14px; }
.search-filter-row { display:grid; grid-template-columns:minmax(150px,1.4fr) repeat(2,minmax(120px,1fr)) auto; gap:9px; align-items:end; }
.search-filter-row label { display:grid; gap:5px; color:#768177; font-size:10px; font-weight:630; }
.search-filter-row button { min-height:44px; padding:0 18px; border:0; border-radius:12px; color:white; background:var(--mama-brand); font:inherit; font-weight:650; }
@media(max-width:700px) { .search-refined{padding:13px;border-radius:16px}.search-filter-row{grid-template-columns:1fr 1fr}.search-filter-row label:first-child{grid-column:1/-1}.search-filter-row button{min-height:46px} }
.date-chip>small { position:static; height:8px; margin-top:1px; font-size:8px; line-height:8px; }
.avatar-medical svg { width:15px; height:15px; fill:currentColor; }
.rail-no-time { opacity:.72; }
.report-actions .secondary-button { min-height:44px; display:inline-flex; align-items:center; justify-content:center; padding:0 14px; border:1px solid #dfe7df; border-radius:13px; color:#41634a; background:#f8faf7; font:inherit; font-size:13px; font-weight:650; text-decoration:none; cursor:pointer; }
@media(max-width:700px) { .report-actions .secondary-button { flex:1 1 auto; min-width:0; } }
.search-refined { grid-template-columns:minmax(0,1fr); min-width:0; }
.search-refined>* { min-width:0; }
.search-query-label input { width:100%; min-width:0; }
.search-filter-row { width:100%; min-width:0; }
.search-filter-row input,.search-filter-row select { width:100%; min-width:0; }
.search-filter-row button { min-width:0; }
.report-archive,.report-new,.report-reading { width:min(900px,100%); margin:0 auto 30px; }
.report-archive h2,.report-source-list h2 { color:#284c39; font-size:18px; }
.report-archive ol,.report-source-list ol { list-style:none; padding:0; }
.report-archive li { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:16px 3px; border-bottom:1px solid #e2e8e2; }
.report-archive li div { display:grid; gap:3px; }
.report-archive li span,.report-archive li small,.report-reading-head p { color:#69776e; font-size:13px; }
.report-intro { color:#647269; }
.report-reading-head { display:flex; align-items:center; gap:16px; margin:10px 0 20px; padding-bottom:15px; border-bottom:1px solid #dfe7df; }
.report-reading-head h1 { margin:2px 0; }
.report-markdown { margin:28px 0; max-width:780px; line-height:1.75; overflow-wrap:anywhere; }
.report-markdown h2 { margin:28px 0 10px; color:#284c39; font-size:20px; }
.report-markdown h3 { margin-top:19px; }
.report-markdown p { white-space:pre-wrap; }
.report-source-list li { padding:7px 0; border-bottom:1px solid #e8ece8; }
.report-source-list a { text-decoration:none; }
.feed-preview { -webkit-line-clamp:6!important; }
.entry-main p.post-clamp { display:-webkit-box!important; -webkit-box-orient:vertical!important; -webkit-line-clamp:6!important; overflow:hidden!important; }
@media print { .report-reading .report-actions { display:none!important; } .report-reading { width:100%; } }
@media(max-width:700px) { .report-archive li { align-items:flex-start; } .report-archive li .secondary-button { flex:none; } .report-reading-head { align-items:flex-start; } }
