/* Seven EMS cards wrap at Fire's card width. Only the row count differs. */
@media (min-width:1200px) {
  .ems-review-launcher .launcher-grid { flex:1 1 0; grid-auto-rows:minmax(max-content,100%); }
}
@media (min-width:821px) and (max-width:1199px) {
  .ems-review-launcher .module-card:nth-child(4),
  .ems-review-launcher .module-card:nth-child(5) { grid-column:span 2; }
  .ems-review-launcher .module-card:last-child { grid-column:3 / span 2; }
}

#emsPatientQuick > header {min-height:0; padding-block:6px;}
#emsPatientQuick .ems-patient-strip, #emsPatientQuick .ems-quick-head {
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
}
#emsPatientQuick .ems-patient-strip {
  margin-bottom:10px; border-bottom:1px solid var(--line); padding:0 0 8px;
}
#emsPatientQuick .ems-quick-grid {
  display:grid; grid-template-columns:minmax(210px,0.95fr) minmax(240px,1.3fr); gap:18px;
}
#emsPatientQuick h3 {font-size:1rem; margin:0;}
#emsPatientQuick small {color:var(--muted); display:block;}
#emsPatientQuick .ems-clinical {border-inline-start:1px solid var(--line); padding-inline-start:16px;}
#emsPatientQuick .ems-figures {display:flex; justify-content:space-evenly; gap:4px;}
#emsPatientQuick .ems-body {display:grid; justify-items:center; margin:0; flex:1; min-width:0;}
#emsPatientQuick figcaption {font-size:.88rem; font-weight:700;}
#emsPatientQuick svg {display:block; height:clamp(178px,28vh,310px); max-width:100%; width:auto;}
#emsPatientQuick .ems-zone {fill:color-mix(in srgb,currentColor 16%,transparent); stroke:currentColor; stroke-width:1.15;}
#emsPatientQuick .ems-zone[data-command] {cursor:pointer; touch-action:manipulation;}
#emsPatientQuick .ems-zone.marked {fill:#ce2038; stroke:currentColor; stroke-width:1.8;}
#emsPatientQuick .ems-zone[data-command]:hover {fill:color-mix(in srgb,#df2845 65%,transparent);}
#emsPatientQuick .ems-guide {fill:none; stroke:currentColor; stroke-width:.85; opacity:.5; pointer-events:none;}
#emsPatientQuick .ems-readings {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:7px 0 12px; gap:4px 8px;}
#emsPatientQuick .ems-readings div {border-inline-start:2px solid var(--line); padding-inline-start:7px; overflow-wrap:anywhere;}
#emsPatientQuick .ems-readings dt {color:var(--muted); font-size:.8rem;}
#emsPatientQuick .ems-readings dd {font-weight:700; margin:2px 0;}
.ems-findings {list-style:none; margin:4px 0; padding:0;}
.ems-findings li {border-inline-start:3px solid #ce2038; padding-inline-start:8px; margin:6px 0;}
.ems-findings small {display:block;}
#emsPatientQuick .button, .ems-finding-choices .button {min-height:44px;}
@media(max-width:720px){
  #emsPatientQuick .ems-quick-grid {grid-template-columns:1fr;}
  #emsPatientQuick .ems-clinical {border:0; padding:0;}
}

.ems-form-drawings {display:flex; justify-content:center; gap:24px;}
.ems-form-drawings figure {margin:0; text-align:center;}
.ems-form-drawings svg {display:block; height:124px;}
.ems-form-drawings .ems-zone {fill:transparent; stroke:currentColor; stroke-width:1.2; cursor:pointer;}
.ems-form-drawings .marked {fill:#ce2038;}
.ems-form-drawings .ems-guide {fill:none; stroke:currentColor; pointer-events:none;}
.ems-response-strip {display:flex; align-items:center; flex-wrap:wrap; gap:6px 16px; padding:4px 10px; background:var(--panel); border:1px solid var(--line);}
#emsResponseClock {margin-inline-start:auto;}
#emsResponseClock .command-clock {display:flex;align-items:center;gap:5px;}
#emsResponseClock svg {width:34px;height:34px;}
.ems-response-grid {display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:10px;flex:1;min-height:250px;}
.ems-response-grid .full-command-panel {min-width:0;min-height:0;height:auto;margin:0;}
.ems-response-grid .full-command-scroll {overflow:auto;}
#emsCommandMap {position:absolute;inset:0;width:100%;height:100%;min-height:0;overflow:hidden;}
.ems-response-grid .full-command-map > .map-stage {min-height:180px;}
.ems-response-grid .ems-map-details {flex:0 1 auto;max-height:45%;}
#emsCommandMap > svg {width:100%;height:100%;cursor:crosshair;}
#emsCommandMap > small {position:absolute;bottom:0;right:0;background:#12202b;color:white;}
.ems-response-grid .command-aid-progress {grid-template-columns:repeat(auto-fit,minmax(62px,1fr));}
.ems-response-grid .command-support {margin-top:8px;}
.ems-response-grid .command-aid-progress li {min-width:0;font-size:.8rem;}
.ems-response-grid details {margin:5px 0;}
.ems-map-key {display:flex;flex-wrap:wrap;gap:12px;font-size:.85rem;}
.ems-map-key span:first-letter {color:#25996e;}
.ems-map-key span+span:first-letter {color:#a980d2;}
.ems-response-grid .full-command-scroll > p {margin-block:5px;}
.ems-response-log {flex:none;padding:8px 12px;}
.ems-response-log[open] {max-height:35vh;overflow:auto;}
@media(max-width:800px){.ems-response-grid {display:flex;flex-direction:column;overflow:auto;}.ems-response-grid .full-command-panel {flex:none;}}
/* EMS command panels use the same theme surfaces and header as Fire Full Command. */
main.workspace.ems-command-workspace { display:flex; flex-direction:column; gap:10px; min-height:0; }
.ems-command-workspace > .workspace-header, .ems-command-workspace > nav, .ems-command-workspace > .metrics { flex:0 0 auto; }
.ems-command-workspace > .full-command-panel { flex:1 1 auto; min-height:160px; height:auto; margin:0; }
.ems-command-workspace .full-command-scroll { display:block; flex:1 1 auto; min-height:0; overflow:auto; }
.ems-command-workspace .full-command-scroll > .table-wrap { margin-top:8px; }

@media (min-width: 850px) and (max-height: 790px) {
  :is(#emsDispatchTotals, #emsCrewCaseSummary) { margin: 0; }
  :is(#emsDispatchTotals, #emsCrewCaseSummary) .metric-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-height: 0;
    padding: 6px 14px;
  }
  :is(#emsDispatchTotals, #emsCrewCaseSummary) .metric-card strong { font-size: 1.4rem; }
  #emsCrewMilestones > header { padding-block: 4px; }
  #emsCrewMilestones .full-command-scroll { padding-block: 4px; }
  #emsCrewMilestones .data-table :is(th, td) { height: 30px; padding-block: 4px; }
}
