.history-view .page-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 10px}
.history-view .page-heading h1 {margin:0}
.history-view .history-actions {display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
@media(max-width:420px){.history-actions button {padding-inline:10px}.history-view .page-heading {flex-wrap:wrap}}
.history-view .history-tabs {margin:0 0 12px}
.history-view .small-link,.history-view .secondary {min-height:44px}
.history-summary,.history-feedback,.log-heading,.log-empty,.history-export {padding:12px 16px}
.history-summary {border:1px solid var(--border);border-radius:12px;margin-bottom:12px;color:var(--text)}
.history-summary summary,.lab-comparison summary {cursor:pointer}
.history-summary summary {min-height:24px}
.history-summary small {color:var(--muted);margin-inline-start:.5em}
.history-summary p,.lab-comparison .field-help {margin:.5em 0;color:var(--muted)}
.history-feedback,.log-heading,.history-export,.lab-row-actions {display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.log-heading {justify-content:space-between}
.log-heading h2 {margin:0}
.log-compounds {margin:0 16px 12px;border:1px solid var(--border);border-radius:10px;background:var(--panel2)}
.log-compounds summary {cursor:pointer;padding:11px 12px;min-height:44px;color:var(--text);overflow-wrap:anywhere}
.log-compounds summary strong {font-weight:500;margin-inline-start:8px;color:var(--accent)}
.log-compounds .field,.log-compounds .field-help {margin:8px 12px}
.log-compound-options {max-height:15rem;overflow:auto;overscroll-behavior:contain}
.log-compound-option {display:flex;align-items:center;gap:10px;min-height:44px;padding:6px 12px;cursor:pointer;overflow-wrap:anywhere}
.log-compound-option[hidden] {display:none}
.log-compound-option input {flex:none;width:18px;height:18px;accent-color:var(--accent)}
.log-compound-actions {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;border-top:1px solid var(--border)}
.history-view h2 .log-count {display:inline;font-size:.85rem;color:var(--muted);font-weight:500;margin-inline-start:.25rem}
#log-results,#lab-list-heading {scroll-margin-top:16px}
.history-query select,.history-labs select,#lab-result select,#lab-result input:not([type=file]) {min-width:0;max-width:100%;font-size:16px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:9px;min-height:44px}
.history-day h3 {margin:0;padding:9px 16px;background:var(--panel2);border-block:1px solid var(--border);color:var(--muted);font-size:13px;font-weight:600;letter-spacing:normal}
.history-day ul {list-style:none;margin:0;padding:0}
.history-day li+li {border-top:1px solid var(--border)}
.history-entry {width:100%;min-height:30px;padding-block:5px;padding-inline:32px 16px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;color:var(--text);text-align:start;font-size:13px;font-weight:400;font-variant-numeric:tabular-nums}
.history-compound {overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.history-dose {white-space:nowrap}
.history-entry:focus-visible {outline-offset:-3px}
@media(hover:hover){.history-entry:hover {background:var(--panel2)}}
.history-entry-details {margin:0}
.history-entry-details > div {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:12px;padding:10px 0;border-bottom:1px solid var(--border);overflow-wrap:anywhere}
.history-entry-details dt {color:var(--muted)}
.history-entry-details dd {margin:0;white-space:pre-wrap}
.history-export {justify-content:flex-end}
.history-labs .live-row {margin-bottom:12px}
.lab-interval {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-block:10px}
.lab-interval .field,.lab-interval label {min-width:0}
.lab-input-row {border:1px solid var(--border);border-radius:10px;padding:12px;margin:8px 0;min-width:0}
.lab-input-row legend {color:var(--muted);padding:0 6px}
.lab-input-row label,#lab-result > label {display:grid;gap:4px}
.lab-chart {margin:14px 0}
.lab-chart figcaption {margin:0 0 10px}
.chart-frame {display:flex;align-items:stretch;gap:8px}
.chart-axis {display:flex;flex-direction:column;justify-content:space-between;max-width:8em;overflow-wrap:anywhere;color:var(--muted);padding-block:5px}
.chart-frame .lab-spark {flex:1;min-width:0;width:100%;height:125px;color:var(--accent);border-left:1px solid var(--border);border-bottom:1px solid var(--border);stroke:none}
.lab-spark circle {cursor:pointer}
.lab-spark circle[data-active=true] {stroke:var(--text);stroke-width:2}
.chart-axis,.chart-dates {font-size:14px}
.chart-dates {display:flex;justify-content:space-between;gap:10px;color:var(--muted);margin:4px 0 12px}
.lab-comparison {border-block:1px solid var(--border);padding-block:6px;margin-block:12px}
.lab-comparison summary {min-height:44px;align-content:center}
.lab-comparison details {padding-left:8px}
.history-labs .live-list article {display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:6px}
.history-labs .live-list small {display:block;color:var(--muted)}
@media(max-width:650px){
  .history-view .page-heading {flex-direction:row;align-items:center}
  .history-view .page-heading h1 {font-size:1.7rem}
  .history-view .page-heading button {width:auto;flex:none}
  .history-view .history-tabs button {font-size:14px}
}
