/* Patient add/edit dialog: compact desktop form matching the spine application. */
#modal:has(#patient-profile){width:502px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border:1px solid #c9c9c9;border-radius:9px;background:#f0f0f0;color:#111;font-family:Arial,"Microsoft YaHei",sans-serif}
#modal:has(#patient-profile) .modal-head{padding:4px 10px;min-height:30px;background:#f5f5f5;border-bottom:1px solid #ddd}
#modal:has(#patient-profile) .modal-head h2{font-size:12px;font-weight:400;color:#666}
#modal:has(#patient-profile) .modal-head .close{padding:0 5px;font-size:20px;color:#888;background:transparent;line-height:20px}
#modal:has(#patient-profile) .modal-body{padding:10px}
#patient-profile{font-size:12px;line-height:1.35}
#patient-profile .profile-fields{display:grid;gap:6px}
#patient-profile .profile-row{display:grid;grid-template-columns:96px minmax(0,1fr);align-items:center;gap:6px;margin:0;color:#111;font-size:12px;font-weight:400}
#patient-profile .profile-row.required>span{color:#f00;font-weight:700}
#patient-profile .profile-row input,#patient-profile .profile-row select{width:100%;min-width:0;height:28px;margin:0;padding:3px 7px;border:1px solid #ccc;border-radius:2px;background:#fff;color:#111;font:12px Arial,"Microsoft YaHei",sans-serif;box-shadow:none}
#patient-profile .profile-row select{height:22px;padding:1px 3px}
#patient-profile .profile-row input:required:invalid{border:2px solid #ff4141;background:#fff0f0;padding:2px 6px}
#patient-profile .profile-row input:focus,#patient-profile .profile-row select:focus{outline:2px solid #2196f3;outline-offset:1px}
#patient-profile .profile-row input:disabled{background:#e9e9e9;color:#888}
#patient-profile .profile-row input::placeholder{color:#888;opacity:1}
#patient-profile #patient-bmi{display:block;margin:6px 0 0;font-size:12px;color:#2196f3}
#patient-profile .profile-consent{border:1px solid #d5d5d5;border-radius:0;margin:3px 0 6px;padding:8px}
#patient-profile .profile-consent legend{padding:0 3px;color:#111}
#patient-profile .consent-tip{margin:0 0 4px;color:#666}
#patient-profile .consent-status{margin:0 0 5px;padding:4px 7px;background:#f7f7f7;overflow-wrap:anywhere}
#patient-profile button{background:#2196f3;color:#fff;border:0;border-radius:3px;padding:6px 5px;font-size:12px;font-weight:400;min-height:28px;cursor:pointer}
#patient-profile button:hover{background:#1976d2}
#patient-profile button:disabled{opacity:.45;cursor:default}
#patient-profile .consent-buttons{display:grid;grid-template-columns:1.5fr 1fr 1fr 1fr;gap:6px}
#patient-profile .profile-authorization{margin:5px 0;color:#555;font-size:11px}
#patient-profile .profile-authorization summary{cursor:pointer}
#patient-profile .profile-authorization .check{font-size:11px;margin:6px 0}
#patient-profile .profile-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:6px}
@media(max-width:420px){#patient-profile .profile-row{grid-template-columns:90px minmax(0,1fr);gap:4px}#patient-profile .consent-buttons{grid-template-columns:1fr 1fr}#modal:has(#patient-profile) .modal-body{padding:8px}}

/* Keep allocation visible alongside basic information instead of below a long form. */
#modal:has(#patient-profile){width:1040px;max-height:calc(100dvh - 32px);overflow:hidden}
#modal:has(#patient-profile) .modal-head{min-height:40px;padding:8px 14px}
#modal:has(#patient-profile) .modal-head h2{font-size:15px;font-weight:600;color:#27364b}
#modal:has(#patient-profile) .modal-body{padding:0 12px 10px}
#patient-profile{display:flex;flex-direction:column;height:min(790px,calc(100dvh - 100px));min-height:0}
#patient-profile .profile-columns{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:16px;flex:1;min-height:0}
#patient-profile .profile-basic-column,#patient-profile .profile-allocation-column{min-width:0;overflow-y:auto;overscroll-behavior:contain;padding:8px 6px 12px;scrollbar-gutter:stable}
#patient-profile .profile-allocation-column{border-left:1px solid #d8dee7;padding-left:16px}
#patient-profile h3{margin:0 0 12px;font-size:14px;color:#1e3a5f}
#patient-profile .profile-fields{gap:5px}
#patient-profile .patient-selection fieldset{margin:0 0 10px;padding:8px 10px;border:1px solid #ccd8e6;border-radius:6px;background:#fff}
#patient-profile .patient-selection legend{font-size:12px;font-weight:600;color:#1e3a5f;padding:0 4px}
#patient-profile .patient-selection .check{display:flex;align-items:center;gap:7px;margin:0;min-height:28px;padding:3px 0;font-size:12px;font-weight:400;line-height:1.4}
#patient-profile .patient-selection input{width:15px;height:15px;flex:0 0 15px;margin:0;accent-color:#2196f3}
#patient-profile .patient-selection fieldset:last-of-type{display:grid;grid-template-columns:1fr 1fr;column-gap:8px}
#patient-profile .patient-selection .muted{margin:4px 0 10px;font-size:11px;line-height:1.5}
#patient-profile .profile-actions{flex:0 0 auto;padding:10px 4px 0;border-top:1px solid #d8dee7;margin-top:0;background:#f0f0f0}
@media(max-width:700px){
 #modal:has(#patient-profile){max-height:calc(100dvh - 16px)}
 #patient-profile{height:calc(100dvh - 90px)}
 #patient-profile .profile-columns{display:flex;flex-direction:column;overflow-y:auto;gap:14px}
 #patient-profile .profile-basic-column,#patient-profile .profile-allocation-column{overflow:visible;flex:none;scrollbar-gutter:auto;padding:8px 4px;border:0}
 #patient-profile .profile-allocation-column{order:-1}
}
