:root {
  color-scheme: light;
  --paper:#f7f5f0; --ink:#222; --teal:#2f6f6a; --dark:#275a55;
  --line:#e1e3da; --muted:#62716b; --white:#fffefa;
  font-family:"Noto Sans TC","Microsoft JhengHei",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--ink); font-size:17px; line-height:1.55;
}
* {box-sizing:border-box}
body {margin:0;background:#eaece5}
button,input,select,textarea {font:inherit;color:inherit}
button,select,summary,a.download {cursor:pointer}
button {min-height:48px;border:0;border-radius:13px;background:transparent;font-weight:650}
button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible {outline:3px solid #a95e19;outline-offset:3px}
button:hover {filter:brightness(.97)}
button:disabled {opacity:.55}
svg {display:block;flex-shrink:0}
.app-shell {max-width:480px;min-height:100vh;margin:auto;background:var(--paper);box-shadow:0 0 45px #253b3410}
#masthead {min-height:78px;padding:12px 21px;display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid var(--line);background:#fffefa}
.brand,.member-select,.hero-title,.section-head,.section-head h2,.primary,.secondary,.subtle,.small-action,.visit-pill,.chart-key,.bot-name,.med-card-title,.segmented button {display:flex;align-items:center}
.brand {gap:9px;color:#244f48;font-weight:800;letter-spacing:.01em;font-size:21px;white-space:nowrap}
.brand-mark {display:grid;place-items:center;width:38px;height:38px;background:var(--teal);color:#fff8df;border-radius:12px 12px 12px 4px}
.member-select {gap:7px;position:relative;padding:5px 10px 5px 6px;min-height:48px;color:#364d42;font-size:17px}
.member-select b {max-width:5em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.member-select select {position:absolute;inset:0;width:100%;opacity:0;cursor:pointer}
.member-select:focus-within {outline:3px solid var(--teal);border-radius:14px}
.avatar {width:32px;height:32px;display:grid;place-items:center;border-radius:50%;background:#e8dfc9;color:#65563b;font-weight:700}
main {padding:23px 20px 112px}
h1,h2,h3,p,dl {margin:0}
h1 {font-size:32px;letter-spacing:-.045em;line-height:1.25;color:#253b32}
h2 {font-size:22px;line-height:1.4;letter-spacing:-.025em;color:#253b32}
h3 {font-size:19px;line-height:1.45}
.intro {margin:2px 0 19px}.intro p {margin-top:5px;color:var(--muted);font-size:17px}
.today-head {display:flex;justify-content:space-between;align-items:center;gap:5px;margin-bottom:18px}
.today-head .intro {margin:0}.today-head .intro p {letter-spacing:-.05em}
.visit-pill {min-height:48px;padding:0 9px;gap:4px;background:#eeeade;color:#655839;border:1px solid #e2ddce;font-size:15px;white-space:nowrap}
.hero {position:relative;overflow:hidden;border-radius:22px;background:linear-gradient(110deg,#295e57,#367b71);color:white;isolation:isolate;min-height:177px;box-shadow:0 5px 12px #274f4114}
.hero-body {position:relative;padding:19px 20px 18px;z-index:2}
.hero-title {gap:7px;color:#deebd9}.hero-title h2 {color:inherit;font-size:18px;font-weight:600}
.hero-number {font-size:66px;line-height:1.12;font-weight:700;letter-spacing:-.06em;font-variant-numeric:tabular-nums;margin:6px 0 12px}
.hero-number small {font-size:18px;font-weight:500;color:#deebe4;letter-spacing:0}
.hero-meta {display:flex;align-items:center;gap:8px;font-size:16px;font-weight:600}
.hero-meta>span:last-child {text-shadow:0 1px 4px #23554b}
.hero-meta b {color:#c4d5bc}
.landscape {position:absolute;right:0;bottom:0;width:49%;height:100%;pointer-events:none;mask-image:linear-gradient(to right,transparent,#000 20%)}
.primary,.secondary,.subtle,.small-action,.download {justify-content:center;gap:8px;text-decoration:none}
.primary {background:var(--teal);color:white;padding:10px 18px}
.secondary,.download {border:1px solid #c8d7cc;background:#f0f4eb;color:var(--dark);padding:9px 16px;font-weight:650}
.subtle {color:#655e53;padding:9px 16px}
.add-reading {width:100%;height:53px;margin-top:11px;font-size:20px;letter-spacing:.03em}
.wide {width:100%}
main>section:not(.hero),#sheet-content>.section-head {margin-top:25px}
.section-head {justify-content:space-between;gap:8px;margin-bottom:10px}
.section-head h2 {gap:8px}.section-head h2 svg {color:var(--teal)}
.count,.small-action {color:#526b5f;font-size:15px}
.small-action {padding:0 10px;color:var(--teal);font-size:17px}
.box {background:var(--white);border:1px solid var(--line);border-radius:17px}
.timeline {padding:0 14px}
.reading-row {display:grid;grid-template-columns:67px 1fr auto;align-items:center;gap:9px;min-height:82px;position:relative}
.reading-row+.reading-row {border-top:1px solid #e9eae2}
.time-rail {font-variant-numeric:tabular-nums;display:flex;align-items:center;gap:8px;font-weight:650;font-size:16px;align-self:stretch;position:relative}
.time-rail:before {content:"";position:absolute;width:1px;background:#dce4d7;left:4px;top:0;bottom:0}
.reading-row:first-child .time-rail:before {top:50%}.reading-row:last-child .time-rail:before {bottom:50%}
.reading-desc {overflow-wrap:anywhere}.reading-desc strong {font-size:17px}
.reading-desc small,.med-log small,.chart>small,.fine,.order summary small {display:block;color:var(--muted);font-size:15px}
.reading-desc small,.med-log small {font-size:17px}.reading-value {display:flex;flex-direction:column;align-items:flex-end;line-height:1.2;gap:3px;padding:6px 0}
.reading-value>b {font-size:27px;color:#2a3b32;letter-spacing:-.045em}
.normal {--state:#3e8e5b;--wash:#e4f1e3;--state-ink:#2c6942}
.below,.low {--state:#7b5ea7;--wash:#f0eaf7;--state-ink:#694d92}
.high {--state:#d98b2b;--wash:#fff0d8;--state-ink:#875316}
.severe {--state:#c8453a;--wash:#f9e4df;--state-ink:#9a332b}
.dot,.badge i {display:inline-block;flex:none;border-radius:50%;background:var(--state)}
.dot {width:9px;height:9px;position:relative}
.badge {display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:30px;background:var(--wash);color:var(--state-ink);font-size:14px;font-weight:700;line-height:1.4;white-space:nowrap}
.badge i {height:6px;width:6px}
.hero .badge {padding:3px 10px;color:var(--state-ink);text-shadow:none}
.med-logs {padding:0 12px}.med-log {display:flex;gap:5px;align-items:center;min-height:78px;padding:9px 0}
.med-log+.med-log {border-top:1px solid var(--line)}.med-log>div {flex:1;overflow-wrap:anywhere}
.med-log em {color:#646c65;font-size:15px;font-style:normal;text-align:right}
.taken em {color:#35724f}.tick {min-width:42px;padding:0 5px;display:grid;place-items:center}
.tick span {border:2px solid #bdc5bd;border-radius:6px;width:23px;height:23px;display:grid;place-items:center}
.taken .tick span {background:var(--teal);border-color:var(--teal);color:white}
.metrics {display:grid;grid-template-columns:repeat(2,1fr);overflow:hidden}
.metrics>div {padding:14px 18px;border-bottom:1px solid var(--line)}.metrics>div:nth-child(odd){border-right:1px solid var(--line)}.metrics>div:nth-last-child(-n+2){border-bottom:0}
.metrics b,.metrics small {display:block}.metrics b {font-size:31px;color:var(--dark)}
.metrics small {font-size:16px;color:var(--muted)}
.chart,.report,.med-card,.fold {padding:16px}
.chart>svg {width:100%;height:auto}.chart svg text {font:12px sans-serif;fill:#53635b}.chart-key {font-size:14px;gap:6px;flex-wrap:wrap}.chart-key i {height:3px;width:20px;background:var(--teal)}
.band-key {width:18px;height:10px;background:#dcebdc;margin-left:10px}
footer {color:#68766d;font-size:14px;margin-top:28px;padding-top:14px;border-top:1px solid var(--line)}
#tabs {position:fixed;z-index:5;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,480px);display:grid;grid-template-columns:repeat(5,minmax(0,1fr));background:#fffefa;border-top:1px solid #dce1d6;padding:6px 6px calc(7px + env(safe-area-inset-bottom));box-shadow:0 -4px 16px #314a3708}
#tabs button {display:flex;flex-direction:column;align-items:center;gap:1px;padding:2px 0;color:#667369;font-size:15px;line-height:1.5;white-space:nowrap}
#tabs .quick-reading {width:56px;height:56px;justify-self:center;justify-content:center;transform:translateY(-15px);border-radius:50%;background:var(--teal);color:white;box-shadow:0 3px 8px #254b4326}
#tabs button>span {display:grid;place-items:center;width:53px;height:30px;border-radius:12px}
#tabs [aria-current] {color:#215c54}#tabs [aria-current]>span {background:#dfede2}
.segmented {display:grid;grid-template-columns:1fr 1fr;padding:4px;border-radius:15px;background:#e8ece3}
.segmented button {justify-content:center;gap:7px;color:#53645b}.segmented [aria-pressed=true]{background:var(--white);color:var(--dark);box-shadow:0 1px 4px #334d3020}
.calendar-box {padding:10px 6px 12px;touch-action:pan-y}
.month-nav,.between,.card-actions,.report-tools,.sheet-head {display:flex;align-items:center;justify-content:space-between;gap:8px}
.month-nav {padding:0 4px 10px}.month-nav button,.close {width:48px;display:grid;place-items:center;color:var(--teal)}
.calendar-grid {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px}
.calendar-grid>strong {font-size:15px;text-align:center;color:var(--muted);padding:5px 0}
.day {border-radius:8px;padding:2px 0;min-height:65px;display:flex;align-items:center;flex-direction:column;background:var(--wash,transparent);color:var(--state-ink,#586159);line-height:1.25;position:relative}
.day>span {font-size:14px}.day sup {font-size:11px;position:absolute;right:2px;top:0}
.day b {font-size:18px}.day small {font-size:12px;white-space:nowrap}.current-day {outline:2px solid var(--teal);outline-offset:-2px}
.day.below small {white-space:normal}
.legend,.fine {font-size:15px;color:var(--muted);margin:13px 5px 0}
.report-tools label {flex:1}.report-tools {align-items:flex-end;margin-bottom:18px}.report>p,.report dl {font-size:16px;color:#4d5b50;margin:10px 0}
dl {display:grid;grid-template-columns:auto 1fr;gap:6px 12px}dt {color:var(--muted)}dd {margin:0;overflow-wrap:anywhere}
.report>.table-hint {color:var(--muted);font-size:15px}
@media screen {
  .table-scroll th:first-child {position:sticky;left:0;z-index:1;background:var(--white);white-space:nowrap}
  .table-scroll thead th:first-child {background:#e9eee5}
}
.table-scroll {overflow-x:auto}table {border-collapse:collapse;min-width:660px;width:100%;font-size:15px}caption {text-align:left;font-weight:700;margin:8px 0}
td,th {border:1px solid #d6dfd5;padding:6px;vertical-align:top;text-align:left}thead {background:#e9eee5}
td:last-child {min-width:130px;overflow-wrap:anywhere}.table-value {display:inline-flex;flex-direction:column;align-items:center;background:var(--wash);color:var(--state-ink);padding:1px 5px;margin:1px;font-weight:650}.table-value small {font-size:12px}
.med-card,.fold {margin:9px 0}.med-card-title {gap:9px}.tile {border-radius:11px;background:#e4eee3;color:var(--teal);padding:9px}
.prescription {color:var(--dark);font-weight:650;margin:9px 0}.med-card dl {font-size:17px}.card-actions {justify-content:flex-end;margin-top:8px}
.fold summary {cursor:pointer;min-height:48px;align-content:center;color:var(--dark);font-weight:650}.fold {overflow-wrap:anywhere}.fold p {margin:9px 0;white-space:pre-wrap}
.order summary small {display:inline}.order summary strong {display:block}.order-photo {max-width:100%;max-height:250px;border-radius:10px;margin-top:9px}
.settings {padding:0 14px}.setting {display:flex;width:100%;padding:12px 0;justify-content:space-between;align-items:center;text-align:left;border-radius:0}.setting+.setting,.between+.between {border-top:1px solid var(--line)}.between {padding:8px 0}
.chat-feed {display:flex;flex-direction:column;gap:12px;padding:18px 0}.chat-date {text-align:center;color:var(--muted);font-size:15px}
.bot-bubble,.user-bubble {max-width:93%;border-radius:4px 18px 18px 18px;padding:12px 15px;background:var(--white);border:1px solid var(--line);align-self:flex-start;overflow-wrap:anywhere}
.bot-name {gap:5px;color:var(--teal);font-size:15px;font-weight:650;margin-bottom:6px}.chat-reading {border-left:4px solid var(--state);padding-left:9px}.chat-reading b {font-size:28px}.chat-reading small,.user-bubble small {display:block;color:var(--muted);font-size:15px}
.chat-reading p {color:var(--state-ink);background:var(--wash);padding:7px;border-radius:6px;margin:7px 0 0}
.user-bubble {align-self:flex-end;background:#e0ede2;border-radius:18px 4px 18px 18px}.snapshot-pages img {display:block;width:100%;margin:8px 0;border-radius:10px}.download {display:flex;min-height:48px}
.chat-form {border-top:1px solid var(--line);padding-top:14px}.chat-form label {font-weight:650}.chat-form>div {display:flex;gap:8px}.chat-form input {min-width:0}.chat-form button {flex:none}
input:not([type=radio]):not([type=checkbox]),select,textarea {border:1px solid #bbc8bd;border-radius:10px;background:#fffefa;padding:9px 11px;width:100%;min-height:48px}
textarea {resize:vertical}.empty {padding:16px;color:var(--muted)}
dialog {position:fixed;inset:auto 0 0;max-width:480px;width:100%;max-height:88dvh;margin:0 auto;padding:0 19px calc(20px + env(safe-area-inset-bottom));border:0;border-radius:23px 23px 0 0;background:var(--paper);color:var(--ink);overscroll-behavior:contain}
dialog::backdrop {background:#183a31a3}body:has(dialog[open]) {overflow:hidden}
.handle {width:42px;height:5px;background:#c4cbc1;border-radius:10px;margin:10px auto 3px}
.sheet-head {margin-bottom:13px}.sheet-form {display:grid;gap:14px}.sheet-form label.field {display:grid;gap:5px;font-weight:650}.field input,.field select,.field textarea {font-weight:400}
fieldset {border:0;margin:0;padding:0;min-width:0}legend {padding:0;margin-bottom:6px;font-weight:650}
.choices {display:flex;gap:7px;flex-wrap:wrap}.choices label {position:relative;cursor:pointer}
.choices input {position:absolute;opacity:0}
.choices span {min-height:48px;display:flex;align-items:center;border:1px solid #bbc8bd;border-radius:10px;padding:7px 11px;background:#fffefa}
.choices input:checked+span {background:#dbeade;color:var(--dark);border-color:var(--teal);box-shadow:inset 0 0 0 1px var(--teal)}
.choices input:focus-visible+span {outline:3px solid #a95e19}
input.big-input {font-size:40px;font-weight:650;color:var(--teal)}input.big-input::placeholder {font-size:23px}
.two {display:flex;gap:10px}.two>* {flex:1;min-width:0}.form-error {color:#943e33}.form-error:empty {display:none}
#toast {position:fixed;z-index:10;bottom:90px;left:50%;transform:translate(-50%,6px);max-width:calc(100% - 30px);width:max-content;background:#213f36;color:white;padding:9px 15px;border-radius:12px;opacity:0;pointer-events:none;transition:.16s}
#toast.visible {opacity:1;transform:translate(-50%,0)}
@media(max-width:390px){
  main {padding-inline:15px}#masthead {padding-inline:15px}.brand {font-size:19px}.visit-pill {font-size:14px;padding:0 7px;gap:3px}.hero-body {padding-inline:16px}
  .timeline {padding-inline:11px}.reading-row {grid-template-columns:60px 1fr auto;gap:6px}.time-rail {gap:6px}
}
.vital-cards {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:12px}
.vital-cards article {padding:14px;display:grid;gap:3px;justify-items:start;align-content:start}
.vital-cards strong {font-size:clamp(30px,8vw,40px);color:var(--dark);line-height:1.2;letter-spacing:-.05em}
.vital-cards small,.vital-cards article>span:not(.badge) {color:var(--muted);font-size:15px;letter-spacing:0}
.time-rail:before {display:none}.time-rail {gap:4px;color:var(--teal)}
.reading-row {grid-template-columns:68px minmax(0,1fr) auto}
.meal-thumb {display:block;width:56px;height:56px;padding:0;margin:4px 0;border-radius:9px;overflow:hidden}
.meal-thumb img {display:block;width:100%;height:100%;object-fit:cover}
.full-photo {display:block;max-width:100%;max-height:65vh;margin:0 auto 12px;object-fit:contain}
.pressure-mark {margin-top:auto;color:#344e48;font-weight:bold}
.table-bp {white-space:nowrap;color:var(--state-ink);font-weight:650}
.record-types {grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:15px}
.photo-field .order-photo {display:block}.photo-field [hidden] {display:none}
.visit-box {padding:14px 16px}.visit-date {font-size:20px;font-weight:700;color:var(--dark)}
.visit-box h3 {margin:18px 0 6px}.visit-box .fine {margin:0 0 6px}
.visit-stats {grid-template-columns:max-content minmax(0,1fr);border-block:1px solid var(--line);padding:9px 0}
.check-row,.inline-add {display:flex;align-items:center;gap:6px}
.check-row {border-bottom:1px solid var(--line)}.check-row label {display:flex;align-items:center;gap:9px;flex:1;overflow-wrap:anywhere;min-height:48px}
.check-row input {width:20px;height:20px;flex:none;accent-color:var(--teal)}
.check-row input:checked+span {color:var(--muted);text-decoration:line-through}
.inline-add {margin:8px 0 16px}.inline-add input {min-width:0}.inline-add button {flex:none}
.camera-button {position:relative;width:48px;flex:none;display:grid;place-items:center;background:#e5eee5;border-radius:10px;overflow:hidden}
.camera-button input {position:absolute;inset:0;opacity:0;cursor:pointer}.camera-button:focus-within {outline:2px solid var(--teal)}
#print-visit {display:none}
@media print {
  @page {size:A4 portrait;margin:13mm 10mm}
  body,.app-shell,main {background:white!important;max-width:none;width:auto;padding:0;box-shadow:none}
  #masthead,#tabs,button,.screen-only,dialog,#toast,.report-tools {display:none!important}
  .report-view .report {margin:0;border:0;padding:0}.report-view .table-scroll {overflow:visible}
  .report-view table {min-width:0;table-layout:fixed;font-size:10pt}.report-view th:first-child {width:9%}.report-view th:last-child {width:30%}
  .report-view td {min-width:0}.report-view th,.report-view td {padding:3px;line-height:1.25}
  thead {display:table-header-group}tr {break-inside:avoid}.table-value {print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .report-view dl,.report-view .report>p {font-size:11pt}.report-view footer {font-size:9pt;margin-top:8px}
}

@media print {
  .printing-visit .app-shell {display:none}
  .printing-visit #print-visit {display:block}
  .visit-print {padding:0;overflow-wrap:anywhere;font-size:10pt;line-height:1.35}
  .visit-print h1 {font-size:18pt}.visit-print h2 {font-size:12pt;margin:3mm 0 1mm}
  .visit-print p,.visit-print .fine,.visit-print .visit-stats {font-size:10pt;margin:0}
  .visit-print .visit-stats {padding:1mm 0;gap:.5mm 3mm}
  .report-view table,.visit-print table {min-width:0;table-layout:fixed;font-size:9pt}
  .visit-print .table-scroll {overflow:visible}
  .report-view th:first-child,.visit-print th:first-child {width:8%}
  .report-view th:last-child,.visit-print th:last-child {width:25%}
  .report-view td,.report-view th,.visit-print td,.visit-print th {min-width:0;padding:1mm .6mm;line-height:1.2}
  .report .table-value {display:inline;padding:0 1px;margin:0;white-space:normal}
  .report .table-value small {font-size:9pt}
  .visit-print caption {margin:0 0 1mm}
}
.photo-field {display:grid;gap:8px}.photo-field .field-label {font-weight:650}
.photo-pick {display:flex;align-items:center;justify-content:center;gap:10px;min-height:52px;border:1.5px dashed #9fbcb2;border-radius:14px;background:#f0f4eb;color:var(--dark);font-weight:650;cursor:pointer}
.photo-pick:focus-within {outline:3px solid #2f6f6a55;outline-offset:2px}
.visually-hidden {position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
/* 登入畫面 */
.gate {position:fixed;inset:0;z-index:50;background:var(--paper);display:flex;align-items:center;justify-content:center;padding:24px 16px}
.gate[hidden] {display:none}
.gate-card {width:100%;max-width:400px;display:grid;gap:14px;text-align:center}
.gate-card .field {text-align:left;display:grid;gap:6px;font-weight:650}
.gate-card h1 {margin:0;font-size:28px;color:var(--dark)}
.gate-sub,.gate-note {margin:0;color:var(--muted)}
.gate-note {font-size:15px}
.gate-logo {width:64px;height:64px;margin:0 auto;border-radius:18px;background:var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='m5 14 11-8 11 8v12H5zM8 18h4l2-5 4 9 2-4h4' fill='none' stroke='%23fff8df' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") center/70% no-repeat}
.reading-desc .by {font-weight:400;font-size:14px;color:var(--muted)}

.install-steps{font-size:1.05rem;line-height:1.7;margin-bottom:18px}
.install-steps ol{padding-left:1.4em;margin:6px 0 12px}
.install-steps li{margin:4px 0}
