/* Dialogs have one vertical scroll surface; the page stays fixed, including iOS. */
html.modal-open{overflow:hidden;overscroll-behavior:none}
body.modal-open{position:fixed;top:var(--modal-scroll-top);left:0;right:0;width:100%;overflow:hidden;overscroll-behavior:none}
#modal{overflow:hidden;max-height:calc(100dvh - 28px);max-width:760px;margin:auto;overscroll-behavior:none}
#modal.modal-wide{max-width:1120px}
#modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 30px);min-width:0;overflow:hidden}
.modal-head,.modal-foot{flex:none;min-width:0;position:relative}
.modal-head{gap:14px}.modal-head h2{min-width:0;overflow-wrap:anywhere;line-height:1.35}.modal-head .close{flex:none}
.modal-body{flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;overflow-wrap:anywhere}
.modal-body form,.form-grid>*,.slot>*{min-width:0;max-width:100%}
.field input,.field select,.field textarea{min-width:0;max-width:100%}
.slot{grid-template-columns:repeat(3,minmax(0,1fr)) 36px}
.check input{flex:0 0 18px}.modal-body .check{overflow-wrap:anywhere}
.modal-foot{flex-wrap:wrap}.modal-foot .btn{min-width:0;white-space:normal}
.truncate{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;overflow-wrap:normal}
.task-table{table-layout:fixed}.task-name-col{width:46%}.task-status-col{width:19%}.task-area-col{width:21%}.task-due-col{width:14%}
.task-table td,.task-table th{overflow:hidden}.task-table th{letter-spacing:.2px}.task-status{background:#eef2f8;border-radius:6px;padding:4px 6px;color:#516078;font-size:12px}
.task-table small{margin-top:4px}.task-detail{background:none;color:#65748a;padding:3px 0;font-size:12px;text-decoration:underline;text-underline-offset:3px}
.card-head h2,.row-main strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.card-head h2{flex:1}.card-head{min-width:0}
.journal-history{margin-top:36px;scroll-margin-top:85px}.history-heading{display:flex;gap:14px;align-items:flex-start;justify-content:space-between;margin-bottom:22px}.history-heading p{margin-top:6px}
.history-filters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:18px;background:#f5f7fb;border-radius:12px;margin-bottom:20px}.history-filters .history-search{grid-column:span 2}
.history-count{font-size:13px;color:var(--muted);margin:14px 0}.answer-list{display:grid;gap:12px}.answer-entry{border:1px solid var(--line);border-radius:12px;padding:18px;display:grid;grid-template-columns:110px minmax(0,1fr);gap:18px}.answer-date{font-size:13px;color:var(--muted)}.answer-date .task-detail{display:block;margin-top:4px}.answer-entry h3{font-size:15px;line-height:1.5;margin:8px 0}.answer-text{white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;background:#f6f8fb;border-radius:8px}.answer-score{display:inline-flex;gap:9px;align-items:center;font-size:13px;color:var(--muted)}.answer-score strong{display:grid;place-items:center;width:36px;height:36px;background:#eaf1ff;border-radius:9px;color:#235db7;font-size:19px}.history-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:18px}
.health-chart-card .card-head{margin-bottom:8px}.health-chart-card .card-head h2{white-space:normal}.chart-open{display:block;text-align:left;width:100%;padding:0;background:transparent;color:inherit;border-radius:8px}.chart-open:hover{background:#f7faff}.chart-open-hint{display:block;text-align:right;color:var(--accent);font-size:12px;margin-top:8px}.health-section-title{margin:30px 0 18px}.health-detail-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:18px 0}.health-detail-stat{padding:14px;border:1px solid var(--line);border-radius:12px;background:#f8fafc}.health-detail-stat small{display:block;color:var(--muted);font-size:12px}.health-detail-stat strong{display:block;font-size:22px;margin-top:5px}.detail-range{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}.detail-dates{display:grid;grid-template-columns:1fr 1fr auto;align-items:end;gap:10px}.health-detail-chart{width:100%;display:block;min-width:0}.health-detail-chart text{font-size:12px;fill:#687a90}.health-detail-chart [role=button]{cursor:pointer;outline:none}.health-detail-chart [role=button]:focus circle:last-child{stroke:#172c4c;stroke-width:3}.health-detail-chart .selected-point{fill:#142b4f;stroke:white;stroke-width:3}.chart-point-note{background:#edf3fc;border-radius:10px;padding:14px;margin:12px 0;color:#3e577d;font-size:14px;min-height:58px}.health-values{width:100%;table-layout:fixed}.health-values th:first-child{width:24%}.health-values th:nth-child(2){width:24%}.health-values td{overflow-wrap:anywhere}.health-values button{color:var(--accent);background:none;padding:0;text-align:left;font-size:inherit}.detail-explanation{font-size:13px;color:var(--muted);margin:10px 0}.health-values tr.active{background:#f0f5ff}.history-error{color:#ad334b}
@media(max-width:700px){
 #modal{width:calc(100% - 20px);max-height:calc(100dvh - 20px);border-radius:16px}
 #modal-content{max-height:calc(100dvh - 22px)}.modal-head{padding:16px}.modal-head h2{font-size:19px}.modal-body{padding:18px 16px}.modal-foot{padding:14px 16px}
 .slot{position:relative;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:12px;border:1px solid var(--line);border-radius:10px}.slot>.field:first-child{grid-column:1/-1;padding-right:36px}.slot .close{position:absolute;right:12px;top:34px;width:28px;height:36px}.slot input{padding:9px 4px}.field input[type=date],.field input[type=time],.field input[type=datetime-local]{appearance:none;-webkit-appearance:none;min-height:44px}
 .task-name-col{width:40%}.task-status-col{width:22%}.task-area-col{width:21%}.task-due-col{width:17%}.task-table{font-size:13px}.task-table th{font-size:10px}.task-table td,.task-table th{padding:12px 4px}.task-table td:first-child,.task-table th:first-child{padding-left:0}.task-table small,.task-status{font-size:10px}.task-status{padding:4px}.task-detail{font-size:11px}
 .history-heading{flex-wrap:wrap}.history-filters{grid-template-columns:repeat(2,minmax(0,1fr));padding:12px;gap:10px}.history-filters .field{font-size:12px}.history-filters .history-question{grid-column:1/-1}.history-filters .history-search{grid-column:1/-1}.answer-entry{grid-template-columns:1fr;gap:10px;padding:14px}.answer-date{display:flex;gap:12px;align-items:center}.answer-date .task-detail{margin:0}.history-pagination{font-size:12px}.health-detail-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.health-detail-stat{padding:11px}.health-detail-stat strong{font-size:20px}.detail-dates{grid-template-columns:1fr 1fr}.detail-dates .btn{grid-column:1/-1}.health-values{font-size:12px}.health-values th{font-size:10px}.health-values td,.health-values th{padding:10px 5px}.detail-range .tab{padding:8px 11px;font-size:13px}
}
