*{box-sizing:border-box} [hidden]{display:none!important}
:root{font:17px/1.55 system-ui,"Microsoft YaHei",sans-serif;color:#213e36;background:#f8f9f5;--green:#176652;--line:#dce4de}
body{margin:0} .wrap{width:min(92%,830px);margin:auto} header{background:white;border-bottom:1px solid var(--line)}
.bar,.heading,.toolbar,.dates,.actions,.file{display:flex;align-items:center;gap:10px}
.bar{height:72px;justify-content:space-between}.bar strong{display:flex;align-items:center;gap:11px;font-size:21px}
.brand{display:grid;place-items:center;background:var(--green);color:white;width:37px;height:37px;border-radius:13px;font:30px Arial}
main{padding:24px 0 130px}h1,h2,h3,p{margin:0 0 12px}h2{font-size:20px}h3{font-size:19px}
button,input,select,textarea{font:inherit;color:inherit;border:1px solid var(--line);border-radius:12px;padding:10px 14px;background:white;min-height:45px;min-width:0}
button,a,.attach{cursor:pointer;touch-action:manipulation}button:hover,.attach:hover{filter:brightness(.95)}button:disabled{opacity:.55;cursor:wait}
.primary,nav [aria-pressed=true]{background:var(--green);color:white;border-color:var(--green);font-weight:600}
a{color:var(--green)}small,#count,.meta{font-size:15px;color:#526c61}
input,select,textarea{width:100%;display:block}label{display:block;font-weight:600;margin:16px 0 6px}label input,label textarea,label select{margin-top:6px;font-weight:400}
.banner{position:relative;isolation:isolate;background:#e7f0e5;border-radius:22px;padding:28px 30px;overflow:hidden}
.banner svg{height:100%;width:63%;position:absolute;right:0;bottom:0;z-index:-1}
.banner h1{font-size:36px;margin:3px 0;letter-spacing:.02em}.dates{margin:16px 0 22px}.dates input{max-width:205px;text-align:center}.dates button:is(#prev,#next){font:28px/1 Arial;padding:6px 14px}
.toolbar input{flex:1}.toolbar button{padding-inline:28px}nav{display:flex;gap:7px;flex-wrap:wrap;margin:16px 0 21px}nav button{border-radius:24px;padding:7px 17px}
.heading{margin:4px 0 12px}.heading h2{margin:0 auto 0 0}.heading button,#logout{background:transparent;border:0;color:var(--green);padding:4px}
.card,.empty,#gate{display:block;width:100%;background:white;border:1px solid var(--line);padding:20px;border-radius:17px;margin-bottom:14px;text-align:left;overflow-wrap:anywhere}
.empty{text-align:center;padding:44px 16px;color:#587067}.card .meta,.meta{display:flex;align-items:center;gap:12px;margin-bottom:12px}.tag{padding:4px 11px;border-radius:9px;font-weight:600;background:#e7ede9;color:#395c50}.meal{background:#fcf0d7;color:#84522d}.med{background:#e3eefb;color:#305d8e}.photo{background:#eee7f6;color:#694781}.hospital{background:#f9e5e1;color:#994c44}
.note{white-space:pre-wrap;overflow-wrap:anywhere}.card .note{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.thumbs{display:flex;gap:8px;margin-bottom:10px}.thumbs img{width:min(22%,110px);aspect-ratio:1;object-fit:cover;border-radius:10px}
#gate{max-width:460px;margin:7vh auto;padding:26px}dialog{width:min(95%,540px);max-height:90vh;max-height:90dvh;border:0;padding:22px;color:inherit;border-radius:20px;overflow-wrap:anywhere}dialog::backdrop{background:#112b24a6}body:has(dialog[open]){overflow:hidden}
.attach{position:relative;text-align:center;color:var(--green);border:1px dashed #78a295;border-radius:12px;padding:13px;overflow:hidden}.attach input{position:absolute;inset:0;opacity:0;cursor:pointer;height:100%;margin:0}.attach:focus-within{outline:2px solid}
.file{justify-content:space-between;margin-top:9px}.file span{min-width:0;overflow-wrap:anywhere}.file button{flex-shrink:0}#detail a{display:block;margin:12px 0}#detail img{display:block;width:100%;border-radius:12px;max-height:55vh;object-fit:contain;background:#f6f7f4}.actions{justify-content:space-between;margin-top:22px}#del,.error{color:#a13329}.error{margin:12px 0}form .primary{width:100%}
#toast{position:fixed;bottom:105px;left:50%;transform:translateX(-50%);background:#223f38;color:white;padding:12px 20px;border-radius:14px;max-width:90%;width:max-content}
.voice{background:#eff5ef;border-radius:14px;padding:12px;margin:6px 0 8px}
.keep-audio{display:flex;align-items:center;gap:9px;min-height:42px;margin:0;cursor:pointer}
.keep-audio input{width:24px;height:24px;min-height:0;margin:0;accent-color:var(--green)}
.keep-audio+small{display:block;margin:0 0 12px}
audio{display:block;width:100%;margin:6px 0 14px}
.voice-actions{display:flex;align-items:stretch;gap:8px;flex-wrap:wrap}
.voice-actions button{min-height:48px;padding:9px 12px}
#speak,#speak[hidden]+#chooseAudio{flex:1 1 145px;display:flex;justify-content:center;align-items:center;gap:6px;color:white;background:var(--green);border:0;font-weight:600}
#speak.recording{background:#a3372e}
#voiceTime{font-variant-numeric:tabular-nums}
#voiceHelp{display:block;margin-top:8px}
#voiceStatus{margin:8px 0 0;font-weight:600}
#voiceStatus:empty{display:none}
#photoOptions{background:#eff5ef;border-radius:14px;padding:10px 14px;margin-top:14px}
#uploadSize{font-size:15px;color:#526c61;margin:10px 0}
#uploadBar{display:block;width:100%;height:17px;accent-color:var(--green)}
#uploadText{font-size:16px;color:var(--green);margin:6px 0;overflow-wrap:anywhere}
#voiceStatus.failed{color:#a13329}
@media(max-width:600px){main{padding-top:15px}.bar{height:62px}.banner{padding:19px}.banner h1{font-size:27px}.banner svg{width:57%}.dates{gap:6px;margin:12px 0 16px}.dates input{flex:1;max-width:none;padding-inline:4px}.dates button{padding-inline:10px}nav{gap:5px;margin:12px 0}nav button{font-size:15px;padding:6px 9px;flex:1 0 auto}.heading{gap:5px}.heading button{font-size:15px}.heading h2{font-size:18px}#add{position:fixed;z-index:2;bottom:calc(18px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:90%;box-shadow:0 5px 22px #143a3340;min-height:53px;font-size:19px}.card{padding:15px}dialog{padding:17px}}

/* Large, high-contrast editor. Shared by the home shortcuts and existing records. */
#editor{--ink:#092e16;--leaf:#087433;--sz:19px;--side:17px;width:min(100%,558px);max-width:100%;max-height:94dvh;padding:0;color:var(--ink);background:#fffefa;border-radius:22px;font-size:var(--sz);line-height:1.42;overscroll-behavior:contain}
html.large-type #editor{--sz:23px}
#entry{display:flex;flex-direction:column;min-width:0;padding:calc(var(--side) + env(safe-area-inset-top)) var(--side) calc(20px + env(safe-area-inset-bottom))}
#editor .editHead{position:relative;display:flex;align-items:center;justify-content:center;min-height:48px;margin:0 0 17px}
#editor #editTitle{margin:0 40px;font-size:1.42em;line-height:1.28;text-align:center;font-weight:750;color:var(--ink)}
#editor #cancel{position:absolute;left:-9px;top:50%;transform:translateY(-50%);display:grid;place-items:center;border:0;background:transparent;color:var(--ink);width:46px;height:48px;padding:0}
#editor .editRow{display:grid;grid-template-columns:4.45em minmax(0,1fr);align-items:center;gap:8px;margin-bottom:13px}
#editor label{font-weight:700;color:var(--ink)}
#editor .editRow label{margin:0}
#editor .editRow :is(input,select),#editor textarea{width:100%;min-width:0;max-width:100%;min-height:47px;padding:7px 10px;border:1px solid #c7cec8;background-color:white;color:#16201a;font:inherit;border-radius:10px;box-sizing:border-box}
#editor .editRow select{appearance:none;padding-right:32px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12'%3E%3Cpath fill='%2309682c' d='M1 2h16l-8 9z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 13px center}
#editor input::-webkit-date-and-time-value{text-align:left;margin:0}
#editor #editDay{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23097233' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M7 2v6M17 2v6M3 11h18'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 11px center}
#editor #editDay::-webkit-calendar-picker-indicator{opacity:0;cursor:pointer}
#editor :is(button,input,select,textarea,a):focus-visible{outline:3px solid #218345;outline-offset:2px}
#editor small,#editor #uploadSize{font-size:.85em;line-height:1.42;color:#304739}
#editor #selectedCount{margin:10px 0 12px;font-size:1.08em}
#editor #photoGrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
#editor #photoGrid.noPhotos{grid-template-columns:1fr}
#editor .photoTile,#editor #pickPhoto{position:relative;min-width:0;aspect-ratio:.85;overflow:hidden;border-radius:10px}
#editor .photoTile{background:#edece4;box-shadow:0 0 0 1px #dce0d9}
#editor .photoTile a{position:absolute;inset:0;display:grid;place-items:center;overflow:hidden;text-decoration:none}
#editor .photoTile a span{padding:9px;font-size:.8em}
#editor .photoTile img{display:block;width:100%;height:100%;object-fit:cover;object-position:center}
#editor .photoTile button{position:absolute;top:0;right:0;border:none;width:44px;height:44px;min-height:44px;background:transparent;padding:0;font-size:27px;line-height:33px;color:white;isolation:isolate}
#editor .photoTile button:before{content:"";position:absolute;inset:6px;background:#071a13c9;border-radius:50%;z-index:-1;box-shadow:0 0 0 1px #ffffffb3}
#editor #pickPhoto{width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;border:2px dashed #b6c1b9;padding:4px;color:var(--ink);background:#fffefa;font-size:.88em}
#editor #pickPhoto svg{color:var(--leaf)}
#editor .noPhotos #pickPhoto{aspect-ratio:auto;min-height:96px;flex-direction:row;font-size:1em;font-weight:650;background:#f2f8f1;border-color:#81a98c}
#editor #photoOptions{background:transparent;padding:0;margin:14px 0 4px}
#editor .keep-audio{margin:0;min-height:34px;gap:12px;cursor:pointer}
#editor .keep-audio input{margin:0;width:26px;height:26px;min-height:26px;flex:none;accent-color:#13893a}
#editor #qualityHint{display:block;margin:0 0 0 38px}
#editor :is(#pickOther,#toggleExtra){text-align:left;min-height:44px;padding:6px 0;background:none;border:0;color:#126d33;font-size:.91em}
#editor #pickOther{margin-top:7px}
#editor #toggleExtra{border-top:1px solid #dde5dc;border-radius:0}
#editor #extraEntry{margin-top:3px}
#editor .voice{background:#edf6ee;margin-bottom:12px}
#editor #speak:not(.recording),#editor #chooseAudio{background:#087535;color:white}
#editor #uploadState{margin:14px -4px 8px;padding:13px 15px;border-radius:17px;background:#e3f6e6;color:var(--ink)}
#editor .uploadHeading{display:flex;align-items:center;justify-content:space-between;font-size:1.23em}
#editor #uploadBar{display:block;width:100%;height:15px;border:0;border-radius:999px;overflow:hidden;margin:11px 0 8px;appearance:none;background:#bbdfc5;accent-color:var(--leaf)}
#editor #uploadBar::-webkit-progress-bar{background:#bbdfc5;border-radius:999px}
#editor #uploadBar::-webkit-progress-value{background:linear-gradient(90deg,#008f40,#077132);border-radius:999px}
#editor #uploadBar::-moz-progress-bar{background:#077132;border-radius:999px}
#editor #uploadBar:indeterminate{opacity:.5}
#editor #uploadText,#editor #uploadHint{font-size:.88em;color:#153721;margin:3px 0}
#editor :is(#save,#pauseTransfer){margin-top:12px;min-height:54px;border-radius:12px;border:1.5px solid #087332;font-size:1.12em;font-weight:700}
#editor #save{background:#087332;color:white}
#editor #pauseTransfer{color:var(--ink);background:white}
#editor .error:empty{display:none}
#editor .isSaving :is(#toggleExtra,#pickOther,#uploadSize,.photoTile button){display:none}
#editor .isSaving :is(input,select,textarea){opacity:1;-webkit-text-fill-color:currentColor}
#editor .isSaving #pickPhoto{opacity:1}
#editor #keepOriginal{appearance:none;border:2px solid #2e783d;border-radius:6px;background:white;padding:0;opacity:1}
#editor #keepOriginal:checked{border-color:#168538;background:#168538 center/22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 12 6 6 10-13' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
@media(max-width:620px){
 #editor{width:100%;max-width:100%;height:100%;height:100dvh;max-height:100%;max-height:100dvh;border-radius:0;margin:0}
}
@media(max-width:360px){
 #editor{--side:12px;--sz:18px}
 html.large-type #editor{--sz:21px}
 #editor .editRow{grid-template-columns:4.1em minmax(0,1fr)}
}
