/* One modal surface across module forms. Retains native dialog focus/Escape. */
.form-dialog-trigger{margin:.4rem .4rem .6rem 0;text-align:start;white-space:normal}
dialog.shared-form-dialog{box-sizing:border-box;width:min(960px,calc(100% - 32px));max-width:calc(100% - 32px);max-height:calc(100dvh - 32px);padding:0;border:1px solid var(--line,#ccd9df);border-radius:18px;background:var(--surface,#fff);color:var(--ink,#142a43);box-shadow:0 24px 80px #05172740;overflow:auto}
dialog.shared-form-dialog::backdrop{background:#08182c80;backdrop-filter:blur(3px)}
.shared-form-dialog .shared-form-heading{position:sticky;top:0;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;margin:0;border-bottom:1px solid var(--line,#ccd9df);background:var(--surface,#fff)}
.shared-form-heading h2{font-size:1.2rem;line-height:1.35;margin:0;min-width:0}
.shared-form-body{padding:24px;min-width:0}
details.form-dialog-content{margin:0!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
details.form-dialog-content>summary{display:none!important}
details.form-dialog-section>summary{list-style:none;cursor:default;pointer-events:none}
details.form-dialog-section>summary::marker,details.form-dialog-section>summary::-webkit-details-marker{display:none;content:''}
.shared-form-dialog :is(input,select,textarea){box-sizing:border-box;max-width:100%}
.shared-form-dialog .form-actions{gap:10px;flex-wrap:wrap}
:where(dialog.record-dialog)>form{padding:24px;box-sizing:border-box}
.shared-form-dialog [hidden]{display:none!important}
/* Header Close: a readable compact control, not a floating circular icon. */
.form-modal-heading{display:flex!important;align-items:center!important;justify-content:space-between;flex-wrap:wrap;gap:12px;min-width:0;grid-column:1/-1;box-sizing:border-box}
.form-modal-heading>:is(h1,h2,h3,.form-title,div:not(.workspace-dialog-actions)){flex:1 1 14rem;min-width:0;max-width:100%;overflow-wrap:anywhere}
.form-modal-heading>:is(h1,h2,h3){margin:0}
.form-modal-heading>.form-title{padding:0;margin:0}
.form-modal-heading>.form-title>:first-child{margin-top:0}
.form-modal-heading>.form-title>:last-child{margin-bottom:0}
.form-modal-heading>.workspace-dialog-actions{display:flex!important;align-items:center;justify-content:flex-end;flex:0 1 auto;flex-wrap:wrap;gap:8px;min-width:0;max-width:100%;margin-inline-start:auto}
.form-modal-heading .workspace-dialog-actions>.workspace-heading-top{display:flex;flex:0 0 auto;align-items:center;width:auto;margin:0}
.form-modal-heading .workspace-dialog-actions>.button{margin:0}
:is(.patuh-form,.standard-form)>header.form-modal-heading{margin-bottom:12px}
.hse-performance-detail>header.form-modal-heading{margin-bottom:12px}
button.form-modal-close{position:static!important;display:inline-flex!important;align-items:center;justify-content:center;gap:9px;flex:0 0 auto!important;width:auto!important;min-width:88px!important;max-width:none!important;height:40px!important;min-height:40px!important;padding:0 12px!important;margin:0!important;border:1px solid #c4d1dc!important;border-radius:10px!important;background:#f4f7fa!important;color:#28405a!important;box-shadow:none!important;font-family:inherit!important;font-size:13px!important;font-weight:600!important;line-height:1!important;cursor:pointer;transition:background .15s,border-color .15s,color .15s}
button.form-modal-close::before,button.form-modal-close::after{content:none!important}
.form-modal-close-icon{position:relative;display:inline-block;width:14px;height:14px;flex:none}
.form-modal-close-icon::before,.form-modal-close-icon::after{content:'';position:absolute;left:6px;top:0;width:1.5px;height:14px;border-radius:2px;background:currentColor;transform:rotate(45deg)}
.form-modal-close-icon::after{transform:rotate(-45deg)}
button.form-modal-close{justify-self:end;align-self:center}
.hse-performance-detail>button.form-modal-close{justify-self:end}
button.form-modal-close:hover{background:#fff!important;color:#101820!important;border-color:#91a6ba!important}
button.form-modal-close:focus-visible{outline:3px solid var(--primary,#008e75)!important;outline-offset:3px}
[data-theme=dark] dialog.shared-form-dialog,[data-theme=dark] .shared-form-dialog .shared-form-heading{background:#162333;color:#f0f5fa;border-color:#354a60}
[data-theme=dark] button.form-modal-close{background:#223449!important;color:#edf4fc!important;border-color:#486078!important}
[data-theme=dark] button.form-modal-close:hover{background:#fff!important;color:#101820!important;border-color:#91a6ba!important}
@media(max-width:640px){dialog.shared-form-dialog{width:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100dvh - 16px);border-radius:14px}.shared-form-dialog .shared-form-heading{padding:16px;gap:10px}.shared-form-body{padding:16px}.shared-form-heading h2{font-size:1.05rem}button.form-modal-close{min-height:44px!important;height:44px!important;min-width:82px!important}}
@media(prefers-reduced-motion:reduce){button.form-modal-close{transition:none}}
