:root{--button-text:#fff;--status-low:#335fa0;--status-high:#a04723;--status-target:#24734c;--status-neutral:#62756f;--danger:#a72d28}
body[data-theme=dark]{--button-text:#14241f;--status-low:#accdfd;--status-high:#ffbc8a;--status-target:#9ce5b7;--status-neutral:#b6c8bd;--danger:#ffb4b0}
body[data-theme=contrast]{--bg:#000;--surface:#080808;--text:#fff;--muted:#e0e0e0;--border:#aaa;--green:#ffe365;--soft:#202020;--button-text:#000;--status-low:#9acbff;--status-high:#ffca80;--status-target:#b6eac9;--status-neutral:#eee;--danger:#ffb4b0;color-scheme:dark}
body[data-theme=comfort]{--bg:#f3ead3;--surface:#fff5dc;--text:#3b3324;--muted:#615744;--border:#a99c7d;--green:#4e5b2e;--soft:#e6dec5;--button-text:#fff;--status-low:#304f83;--status-high:#8b3d21;--status-target:#3c622c;--status-neutral:#615744;--danger:#922d23;color-scheme:light}
body[data-theme] button,body[data-theme] .button{color:var(--button-text)}
body[data-theme] .secondary,body[data-theme] .profile{color:var(--text);background:var(--surface)}
body[data-theme] .text-button{color:var(--green);background:transparent}
body[data-theme] .danger,body[data-theme] .error,body[data-theme] #form-error,body[data-theme] #date-filter-error{color:var(--danger)}
body[data-theme] .periods button{background:transparent;color:var(--text)}
body[data-theme] .periods .selected{background:var(--green);color:var(--button-text)}
body[data-theme] .badge.low{color:var(--status-low)}body[data-theme] .badge.high{color:var(--status-high)}body[data-theme] .badge.target{color:var(--status-target)}body[data-theme] .badge.neutral{color:var(--status-neutral)}
body[data-theme=contrast] .demo-banner{background:#222;color:#fff;border-bottom:1px solid #aaa}
body[data-theme=contrast] .card,body.accessible input,body.accessible select,body.accessible textarea{border-width:2px}
body[data-theme] :focus-visible{outline:3px solid var(--green);outline-offset:4px;box-shadow:0 0 0 6px var(--surface)}
body[data-theme] .check input{accent-color:var(--green)}
.access-icon{display:inline-block;width:1.4em;height:1.4em;min-width:1.4em;background:currentColor;mask:url(accessibility.svg) center/contain no-repeat;vertical-align:middle}
.skip-link{position:fixed;left:12px;top:8px;z-index:1000;background:var(--surface);color:var(--text);padding:14px;border:2px solid currentColor;transform:translateY(-160%)}.skip-link:focus{transform:none}
.header-controls{flex-wrap:wrap;justify-content:flex-end}.header-controls button{white-space:normal}
.chart-wrap{max-width:100%;overflow-x:auto;margin-bottom:18px;padding:5px}.chart-wrap svg{min-width:46rem;min-height:0}.chart-wrap .axis{font-size:18px}.chart-wrap .point-symbol{font-size:20px}.chart-wrap .dot{stroke:var(--text);stroke-width:2}
.legend{font-size:.88rem;gap:14px}.legend>span{display:inline-flex;align-items:center;gap:8px}.pattern-key{display:inline-block;min-width:24px;width:24px;height:24px;border:2px solid var(--text);background-color:var(--surface)}
.pattern-high{background-image:repeating-linear-gradient(135deg,transparent 0 4px,var(--status-high) 4px 6px)}
.pattern-low{background-image:repeating-linear-gradient(45deg,transparent 0 5px,var(--status-low) 5px 6px),repeating-linear-gradient(135deg,transparent 0 5px,var(--status-low) 5px 6px)}
.pattern-target{background-image:radial-gradient(var(--status-target) 1.5px,transparent 2px);background-size:7px 7px}.pattern-neutral{background-image:repeating-linear-gradient(0deg,transparent 0 4px,var(--status-neutral) 4px 6px)}
.chart-data{margin:20px 0 0}.chart-data summary{font-size:1rem}.table-scroll{overflow-x:auto;max-width:100%}.chart-data table{width:100%;border-collapse:collapse;font-size:.95rem}.chart-data caption{text-align:left;font-weight:700;padding:12px 0}.chart-data th,.chart-data td{border:1px solid var(--border);padding:12px;text-align:left;min-width:8rem}.chart-data th{background:var(--soft)}
.signal-preview{margin:24px 0;padding:20px;border:3px solid var(--green);border-radius:12px;background:var(--soft)}.signal-preview p{font-size:1rem!important}.visual-pulse{animation:signal-outline 2s ease-in-out 2}@keyframes signal-outline{0%,100%{outline:0 solid transparent}50%{outline:6px solid var(--green);outline-offset:3px}}
body.accessible .eyebrow{letter-spacing:.03em}body.accessible .gentle,body.accessible .future-strip,body.accessible .aside-note{display:none}body.accessible button,body.accessible .button{min-height:60px;font-size:1.05rem}body.accessible .row-info strong,body.accessible .row-info span,body.accessible .time-meta{font-size:1rem}
body.large-values .big-value{font-size:6.5rem}body.large-values .row-value strong{font-size:3.4rem}body.large-values .value-input{font-size:3rem}
body[data-scale="160"] .shell{display:block}body[data-scale="160"] aside{padding:24px;border-bottom:1px solid var(--border)}body[data-scale="160"] nav{display:flex;flex-wrap:wrap}body[data-scale="160"] .aside-note,body[data-scale="160"] .version,body[data-scale="160"] .nav-label{display:none}
body[data-scale="160"] .overview-grid{grid-template-columns:1fr}body[data-scale="160"] .page-heading,body[data-scale="160"] header{flex-wrap:wrap}body[data-scale="160"] .form-grid{grid-template-columns:1fr}body[data-scale="160"] .measurement-row{flex-wrap:wrap}body[data-scale="160"] .row-actions{flex-wrap:wrap;margin-left:0}body[data-scale="160"] .stats{flex-wrap:wrap;gap:18px}body[data-scale="160"] .stats>div{min-width:40%}
main,section,.card,.page-heading>div,.header-controls,.row-info,.chart-heading,.form-grid>label{min-width:0}h1,h2,h3,button,.button,.brand,.check,summary{overflow-wrap:anywhere}.check{align-items:flex-start}.check input{flex-shrink:0}.chart-heading{flex-wrap:wrap;gap:8px}.form-card{width:100%}.row-value{flex-shrink:0}.row-info{overflow-wrap:anywhere}
@media(max-width:760px){.header-controls{max-width:none!important;width:100%;justify-content:flex-start}.header-controls button{font-size:.88rem;flex:1 1 100%;min-height:48px}header{flex-wrap:wrap}.simple .header-controls button{flex:1 1 100%}.stats{flex-wrap:wrap;gap:16px}.stats>div{min-width:40%}body[data-scale="160"] nav{display:grid;grid-template-columns:1fr}body[data-scale="160"] main{padding:16px}body.large-values .big-value{font-size:4.9rem}.periods{flex-wrap:wrap}.periods button{flex:1 1 40%}.export-actions{flex-wrap:wrap}.export-actions>*{flex:1 1 100%}.row-info{flex:1 1 100%}.row-actions{flex-wrap:wrap}.row-actions button{flex:1 1 100%}.legend{font-size:.9rem}dialog{max-width:calc(100vw - 24px);padding:18px}.check{font-size:1rem}input,select,textarea{max-width:100%;min-width:0}.welcome h1{font-size:2rem}}
@media(prefers-reduced-motion:reduce){.visual-pulse{animation:none!important}.skip-link{transition:none}}
@media print{body[data-theme]{--bg:white;--surface:white;--text:#14241f;--muted:#44594f;--border:#999;--green:#175f52;--status-low:#335fa0;--status-high:#a04723;--status-target:#24734c;--status-neutral:#44594f}.skip-link{display:none}.chart-wrap{overflow:visible}.chart-wrap svg{min-width:0}.chart-data{display:none}.pattern-key{print-color-adjust:exact}.signal-preview{display:none}}

body.large-values :is(.pressure-values,.measurement-value,#camera-glucose-fields input[name=value],#camera-pressure-fields input,#camera-review-text){font-size:2rem;line-height:1.4;overflow-wrap:anywhere}body.large-values .import-row input[name=value]{font-size:2rem}
