:root{font-family:Inter,system-ui,sans-serif;color:#172b45;background:#f2f5f9}*{box-sizing:border-box}body{margin:0}button,input{font:inherit}button{cursor:pointer;min-height:42px;border:1px solid #bdcadd;border-radius:8px;padding:8px 13px;background:#fff;color:inherit}button:disabled{opacity:.5;cursor:wait}input:not([type=checkbox]){width:100%;padding:12px;border:1px solid #bac9d9;border-radius:8px;min-height:46px;font-size:16px}label{display:block;font-size:15px;margin-bottom:14px}label input{display:block;margin-top:6px}label input[type=checkbox]{display:inline}form p{font-size:14px;line-height:1.5}.auth-box{max-width:420px;margin:10vh auto;padding:28px;background:white;border:1px solid #dce4ee;border-radius:16px}.auth-box h1{font-size:26px}.auth-box button,#add-button,.dialog-actions button[type=submit]{background:#193b60;color:#fff}dialog{width:min(520px,calc(100% - 24px));max-height:90dvh;overflow:auto;border:1px solid #bac9d9;border-radius:15px;padding:24px;background:#fff;color:inherit}dialog::backdrop{background:#0e162299}dialog h2{margin:0 0 20px}#manage-dialog{width:min(880px,calc(100% - 24px))}.management-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.file-label{margin:0}.file-label input{max-width:240px}.table-scroll{overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:14px}th,td{padding:12px 8px;text-align:left;border-bottom:1px solid #dce4ee;white-space:nowrap}td button{font-size:13px;padding:6px;margin:2px}.dialog-actions{display:flex;gap:10px;justify-content:flex-end}#app-status:empty{display:none}#app-status{font-size:14px}.trend-active .measurement-line,.trend-active .measurement-point{opacity:.14}.trend-active .measurement-fill{opacity:.06}.trend-line{opacity:1;stroke-width:2.6px}[hidden]{display:none!important}.sync-actions{flex-wrap:wrap}#empty-state{padding:30px;border-radius:14px;background:#fff}.brand-mark{display:none}[data-theme=dark] dialog,[data-theme=dark] #empty-state{background:#182333;color:#e1eaf5;border-color:#42536b}[data-theme=dark] input,[data-theme=dark] button{background:#233247;color:#e1eaf5;border-color:#42536b}[data-theme=dark] #add-button,[data-theme=dark] .dialog-actions button[type=submit]{background:#42658e;color:#fff}[data-theme=dark] th,[data-theme=dark] td{border-color:#344254}.trend-active .measurement-point{transition:opacity .15s}@media(max-width:700px){main{padding-bottom:92px}#add-button{position:fixed;right:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:20;min-height:50px;box-shadow:0 5px 25px #0004;padding:12px 20px}.sync-actions{margin-left:auto}.auth-box{margin:6vh 12px;max-width:none}dialog{padding:20px}.dialog-actions{position:sticky;bottom:0;background:inherit;padding-top:10px}.dialog-actions button{flex:1}.topbar .period{white-space:normal}.measure-inputs input{font-size:18px}}@media(prefers-reduced-motion:reduce){*{transition:none!important}}

.theme-control{margin-bottom:0}.theme-control select{margin:0}
.desktop-change{display:contents}.desktop-change>span{color:#66778a}[data-theme=dark] .desktop-change>span{color:#a8b8cc}.mobile-label,.mobile-change{display:none!important}
@media(max-width:700px){
 .desktop-label,.metric .desktop-change{display:none!important}
 .mobile-label{display:inline!important}.metric .mobile-change{display:flex!important;flex-direction:column;align-items:flex-end;gap:2px}
 .metric{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);padding:14px 18px;column-gap:10px;row-gap:8px;align-items:start}
 .metric .metric-value{font-size:36px;line-height:1.15;letter-spacing:-1px;margin:0;min-width:0}
 .metric .metric-value>strong{display:inline-flex;align-items:baseline;gap:6px;white-space:nowrap}
 .metric .metric-value>strong>span{display:inline;font-size:20px;line-height:1;letter-spacing:0}
 .metric .metric-value .paired-value{margin:4px 0 0;font-size:15px!important;line-height:1.3;white-space:nowrap}
 .metric .metric-bottom{padding-top:0;gap:0}.metric .metric-bottom strong{font-size:14px;line-height:1.35;white-space:nowrap}
 .mobile-change>span{font-size:12px;line-height:1.4;color:#66778a;white-space:nowrap}[data-theme=dark] .mobile-change>span{color:#a8b8cc}
 .chart-header>.view-buttons{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));width:100%;gap:0}
 .chart-header>.view-buttons button{min-width:0;font-size:14px;padding:9px 4px;white-space:nowrap}
 .chart-options .legend{flex-wrap:nowrap;gap:14px;font-size:14px}.chart-options .legend>span{white-space:nowrap;gap:6px}
 .chart-options .legend>span>.desktop-label{display:none!important}.chart-options .legend>span>.mobile-label{display:inline!important}
 .chart-footer{display:none}
 .range-card .range-label{white-space:nowrap;font-size:13px}.range-card .range-date{font-size:12px}
 .range-card .range-values>div{column-gap:6px}.range-card .range-values strong{white-space:nowrap}
}
/* v1.0.3: aligned management controls and compact mobile entry. */
/* v1.0.4: one theme control and mobile action disclosure. */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;white-space:nowrap;font-size:14px;min-width:85px;height:42px;padding:7px 10px}
#theme-icon{font-size:20px;line-height:1}.header-actions{position:relative}#mobile-menu-toggle{display:none}
@media(max-width:700px){
 .topbar .topbar-content{display:flex;flex-wrap:nowrap;align-items:center;gap:10px;padding:14px 16px}
 .topbar .brand{flex:1;min-width:0;margin:0;font-size:clamp(15px,4.4vw,18px);white-space:nowrap;gap:0}
 .topbar .period{display:none}.topbar .theme-toggle{flex:none;min-width:72px;padding:7px 8px;gap:5px}
 .header-actions{flex:none}#mobile-menu-toggle{display:flex;align-items:center;justify-content:center;width:42px;height:42px;padding:8px}
 #header-menu{display:none;position:absolute;right:0;top:calc(100% + 9px);z-index:40;min-width:195px;margin:0;padding:7px;border:1px solid #c4d0de;border-radius:12px;background:#fff;box-shadow:0 12px 30px #14243c26}
 .header-actions.is-open #header-menu{display:flex;flex-direction:column;align-items:stretch;gap:3px}
 #header-menu button,#header-menu #add-button{position:static;width:100%;min-height:44px;box-shadow:none;text-align:left;padding:10px 12px;border:0;border-radius:6px;background:transparent;color:inherit}
 #header-menu button:hover{background:#edf2f8}[data-theme=dark] #header-menu{background:#182333;border-color:#42536b;color:#e1eaf5}[data-theme=dark] #header-menu button:hover{background:#2c405a}
 body main{padding-bottom:24px}
}
.management-header{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:18px}
.management-header h2{margin:0;flex-shrink:0}.management-header .management-tools{margin-left:auto;flex-wrap:nowrap;gap:8px}
.management-tools button{white-space:nowrap;height:42px;margin:0;line-height:1.2}
#manage-dialog table{table-layout:fixed;width:100%;min-width:660px}
#manage-dialog col.actions-column{width:140px}
#manage-dialog th,#manage-dialog td{white-space:normal;overflow-wrap:break-word}
#manage-dialog th:last-child,#manage-dialog td:last-child{padding-left:0;padding-right:0;white-space:nowrap}
#manage-dialog th:last-child{text-align:left}#manage-dialog td:last-child{text-align:right}
#manage-dialog td:last-child button{margin:0;height:38px;min-height:38px;padding:6px 10px}
#manage-dialog td:last-child button:first-child{width:82px;margin-right:8px}#manage-dialog td:last-child button:last-child{width:50px}
#measurement-form,#measurement-form label{min-width:0;max-width:100%}
#measurement-form .measure-inputs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:14px}
#measurement-form .weight-field{grid-column:1/-1}
#measurement-form input{min-width:0;max-width:100%;width:100%;box-sizing:border-box}
#measure-date{display:block;-webkit-appearance:none;appearance:none;height:46px;min-height:46px;text-align:left}
#measure-date::-webkit-date-and-time-value{text-align:left;min-width:0}
#measurement-error:empty{display:none}
#measurement-dialog .dialog-actions{position:static;padding-top:8px;background:transparent}
#measurement-dialog .dialog-actions button{white-space:nowrap;min-height:40px;height:40px;padding:8px 16px;line-height:1.2}
@media(max-width:700px){
 #measurement-dialog{max-height:calc(100dvh - 32px);overflow-x:hidden}
 #measurement-form label{font-size:14px;margin-bottom:12px}
 #measurement-form .measure-inputs{column-gap:12px}
 #measurement-form input{font-size:16px;padding:10px;min-height:44px}
 #measurement-dialog .dialog-actions button{flex:1}
 .management-header{flex-wrap:wrap;gap:12px}.management-header .management-tools{margin-left:0;flex-wrap:wrap}
 #measurement-dialog:has(#measure-date:not([readonly]):focus)::backdrop{background:rgba(4,10,18,.86)}
 #measurement-dialog:has(#measure-date:not([readonly]):focus) .measure-inputs,#measurement-dialog:has(#measure-date:not([readonly]):focus) .dialog-actions,#measurement-dialog:has(#measure-date:not([readonly]):focus) h2{opacity:.25}
}

/* v1.0.7: metric accents and mobile breathing room. */
.metric.muscle .metric-label,.metric.fat .metric-label,
.metric.muscle .metric-value>strong,.metric.fat .metric-value>strong{color:var(--accent)}
@media(max-width:700px){
 body main{padding-bottom:calc(120px + env(safe-area-inset-bottom,0px))}
 .metric .metric-bottom .mobile-change{width:100%;align-items:flex-end;text-align:right}
}

/* v1.0.8: unobtrusive desktop revision. */
.brand .revision{font-size:11px;font-weight:400;letter-spacing:0;color:#7b8797;white-space:nowrap}
[data-theme=dark] .brand .revision{color:#8593a5}
@media(max-width:700px){.brand .revision{display:none}}

/* v1.0.9: matching side-card headings and compact mobile chart labels. */
.range-card[data-metric=muscle] h3,.range-card[data-metric=fat] h3{color:var(--accent)}
@media(max-width:700px){
 #selected-date{white-space:nowrap}
 #trend-key{display:none!important}
}

/* v1.0.10: chart descriptions remain desktop-only. */
@media(max-width:700px){#scale-caption{display:none}}
