/* Intrinsic widths must not force small-screen grid tracks wider than their cells. */
.form-grid,.settings-grid{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
.form-grid>*,.settings-grid>*,label,fieldset,article,form,.context>*,.filters>*{min-width:0;max-width:100%}
input,select,textarea{box-sizing:border-box;max-width:100%}
input[type=date],input[type=time]{display:block;width:100%;min-width:0;-webkit-appearance:none;appearance:none}
input::-webkit-date-and-time-value{text-align:left;min-width:0}
article form{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
article form button{white-space:nowrap}
.entry{grid-template-columns:65px minmax(0,1fr) 140px 60px}
.history-row{grid-template-columns:105px minmax(0,1fr) minmax(0,1.2fr) 140px}
@media(max-width:650px),(pointer:coarse){
 input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px;line-height:1.25}
}
@media(max-width:650px){
 :root{scrollbar-gutter:auto}
 header{height:44px;padding:0 10px;font-size:15px}.logo{font-size:22px}
 main{padding:8px}nav{margin-bottom:8px}nav button{padding-top:7px;padding-bottom:8px;min-height:34px}
 h1{font-size:17px;margin:0}h2{font-size:14px;margin-bottom:6px}
 .section-title,#settings .section-title{margin:10px 0 7px;gap:6px}.section-title p{font-size:10px;line-height:1.4;margin-top:3px}
 input:not([type=checkbox]):not([type=radio]),select{height:34px;min-height:34px;padding:4px 6px}
 textarea{padding:5px 6px;min-height:48px;resize:vertical}
 label{font-size:11px;gap:3px;line-height:1.3}
 button{min-height:34px;padding:6px 9px;font-size:12px}
 .context,.filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:8px;border-radius:7px}
 .context label:first-child{grid-column:1/-1;min-width:0}
 .context label,.filters label{width:auto;min-width:0}
 .check{min-height:34px;gap:6px;font-size:12px}
 .form-grid{gap:7px 8px;grid-template-columns:repeat(2,minmax(0,1fr))}
 .settings-grid{grid-template-columns:minmax(0,1fr);gap:7px}
 article,#settings article{padding:8px;border-radius:7px}
 article form,#settings article form{margin:0;gap:6px}
 #settings article form input,#settings select{height:34px;min-height:34px;padding:4px 6px}
 #settings article form button{min-height:34px;padding:4px 9px}
 #settings h2{margin-bottom:5px}#settings h3{margin:4px 0;font-size:12px}
 #settings .settings-grid{gap:7px;align-items:start}
 #settings details{margin-top:5px;padding-top:5px}
 #settings details p{margin:5px 0;font-size:11px;line-height:1.4}
 #settings .master-row{padding:3px 0}#settings .master-row button{min-height:30px}
 #settings .store-settings-head{display:grid;grid-template-columns:90px minmax(0,1fr);gap:6px;margin-bottom:5px}
 #settings .store-settings-head label{width:100%}
 #settings .footnote,.footnote{font-size:10px;line-height:1.4;margin:6px 0}
 #settings #eventsMaster,#settings #machinesMaster,#settings #storesMaster,#settings #peopleMaster{max-height:150px}
 .empty{padding:24px 10px}.empty strong{font-size:14px}
 .group-head{padding:6px 8px}.group-head strong{font-size:13px}
 .entry{grid-template-columns:48px minmax(0,1fr) 40px;gap:5px;padding:7px 8px}
 .machine{font-size:12px}.time{font-size:12px}.memo{font-size:11px}.badge{padding:3px 5px;margin:1px;font-size:10px}
 .person-group{margin-bottom:8px}.entry .badges{margin-top:0}
 .stat-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:8px 0}
 .stat-card{padding:8px;font-size:11px}.stat-card strong{font-size:20px}.stat-card:first-child{padding:6px 8px}
 .bar{margin:7px 0 10px;height:8px}th,td{padding:7px 5px;font-size:11px}
 .history-row{grid-template-columns:92px minmax(0,1fr);padding:7px 0;gap:4px 6px}
 dialog{width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:10px;border-radius:10px}
 .dialog-heading{margin-bottom:7px}.dialog-heading h2{font-size:15px}.dialog-heading button{min-height:30px;font-size:21px}
 fieldset{padding:6px 8px}.dialog-actions{margin-top:8px;gap:8px;justify-content:flex-end}
 #deleteRecord{margin-right:auto}#recordForm .footnote{margin:6px 0}
 #share article>label{margin:7px 0}#shareOutput,#shareInput{height:90px}
 #sharePreview{max-height:260px}
}
.machine-picker{display:flex;flex-direction:column;gap:3px;min-width:0}
.machine-choices{border:1px solid #b5cfc5;border-radius:6px;background:white;max-height:min(180px,25dvh);overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch}
.machine-choice{display:block;width:100%;border:0;border-radius:0;border-bottom:1px solid #edf1ef;text-align:left;white-space:normal;overflow-wrap:anywhere;font-size:14px;font-weight:400;line-height:1.4;min-height:36px;padding:7px 9px;background:white}
.machine-choice:last-child{border-bottom:0}.machine-choice[aria-selected=true]{background:#e5f2ed;color:#0b5f55}.machine-no-match{padding:10px;font-size:12px;color:#687d72;line-height:1.5}

.people-filter{min-width:0;font-size:11px;display:flex;flex-direction:column;gap:3px}.people-filter details{margin:0;padding:0;border:0}.people-filter summary{box-sizing:border-box;border:1px solid #d8e2dd;border-radius:6px;background:white;padding:7px 8px;min-height:34px;line-height:1.25;font-size:16px;overflow-wrap:anywhere;cursor:pointer}.people-options{border:1px solid #d8e2dd;border-radius:6px;padding:6px;background:white}.people-options>div{max-height:180px;overflow-y:auto;overscroll-behavior:contain}.people-options label{display:flex;flex-direction:row;align-items:center;gap:8px;padding:6px 2px;min-height:36px;font-size:14px;cursor:pointer}.people-options input{width:18px;height:18px;flex:none}.people-options span{overflow-wrap:anywhere}.people-options small{display:block;font-size:10px;margin-top:5px}.people-options button{width:100%;font-size:12px}
.filters{align-items:start}

/* Compact history: keep every field visible and let long text wrap. */
.person-group{margin-bottom:6px}.group-head{padding:4px 8px;gap:8px}.group-head>div{min-width:0;overflow-wrap:anywhere}.group-head button{flex-shrink:0;min-height:34px;padding:5px 8px}
.entry{display:block;padding:5px 8px}.entry-top{display:flex;align-items:center;gap:6px}.entry-top .time{flex:none;font-size:12px;min-width:34px}.entry-top .machine{flex:1;min-width:0;font-size:12px;line-height:1.4;overflow-wrap:anywhere}.entry-top .edit{flex:none;min-height:34px;padding:4px 7px;font-size:11px}.entry .number,.history-row .number{padding:1px 4px;margin-right:4px}.entry-meta{display:flex;flex-wrap:wrap;align-items:center;gap:2px 8px;line-height:1.4}.entry-meta .badges{display:inline-flex;flex-wrap:wrap;gap:2px}.entry .badge,.history-row .badge{padding:2px 4px;margin:0;font-size:11px;line-height:1.4}.entry-detail{margin:0;font-size:11px;overflow-wrap:anywhere}.entry .memo{margin:2px 0 0;font-size:11px;line-height:1.4}
.history-panel{margin-top:8px;padding:8px}.history-heading{gap:8px}.history-heading h2{min-width:0;overflow-wrap:anywhere}.history-heading>span{flex:none}.history-panel>p{font-size:10px;line-height:1.4;margin:3px 0 5px}.history-list{margin-top:4px}.history-row{display:flex;flex-wrap:wrap;gap:2px 8px;padding:5px 0;font-size:12px;line-height:1.4;align-items:baseline}.history-date{flex:none;max-width:100%}.history-date small{display:inline;margin:0 0 0 6px;font-size:11px}.history-location{flex:1 1 140px}.history-location strong,.history-location>span{display:inline;margin:0;font-size:11px}.history-location>span:before{content:' ／ '}.history-result{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 6px;width:100%;min-width:0}.history-machine{flex:1 1 160px;min-width:0}.history-rating{display:flex;flex-wrap:wrap;gap:2px}
