/* A bounded preparation workspace: one decision surface at a time. */
#modal:has(.custom-workspace){width:min(1220px,calc(100vw - 32px));height:min(790px,94dvh);max-height:94dvh;overflow:hidden}
#modal:has(.custom-workspace) .modal-top{padding:10px 22px;min-height:40px}
#modal:has(.custom-workspace) #modal-content{padding:14px 22px 16px;height:calc(100% - 44px);min-height:0;box-sizing:border-box;overflow:hidden}
.custom-workspace{height:100%;min-height:0;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:12px}
.setup-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;min-width:0}
.setup-heading>div>small{font-size:9px;letter-spacing:2px;color:#91afb7}
.setup-heading .modal-title{font-size:25px;line-height:1.4;margin:4px 0 0;font-weight:400}
.setup-heading .war-tabs{margin:0;flex-shrink:0}
.setup-heading .war-tabs button{padding:10px 18px;min-height:40px}
.setup-steps{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.setup-steps button{display:flex;align-items:center;gap:12px;padding:11px 15px;border:1px solid #435d68;color:#91a8b4;text-align:left;background:#101d28}
.setup-steps button b{font:15px Georgia,serif;color:#6e8a97}
.setup-steps button span{font-size:12px}
.setup-steps button[aria-current=step]{color:#f0d7a0;background:#5b4d2b44;border-color:#b69d65}
.setup-steps button[aria-current=step] b{color:#ebd39a}
.setup-panel{min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:#6e8b95 #0b1721;padding-right:2px}
.setup-footer{display:flex;justify-content:space-between;align-items:center;gap:16px;border-top:1px solid #60768155;padding-top:11px;min-height:50px}
.setup-footer-summary strong{display:block;font:20px Georgia,serif;color:#d5c394}
.setup-footer-summary strong span{font:10px sans-serif;color:#7894a1;padding:0 8px}
.setup-footer-summary small{display:block;font-size:10px;color:#98afb8;margin-top:4px}
.setup-footer-actions{display:flex;align-items:center;gap:12px}
.setup-footer-actions .primary-button{min-height:44px;padding:10px 20px;font-size:12px}
.setup-footer-actions .quiet-button{min-height:40px;padding:8px;font-size:11px}
.setup-side-tabs{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:13px}
.setup-side-tabs>button{display:flex;align-items:center;gap:10px;padding:8px 12px;text-align:left;border:1px solid #3f5965;background:#12232d;min-height:57px}
.setup-side-tabs>button[aria-pressed=true]{border-color:#bca36e;background:#3c3b294d}
.setup-side-tabs>button>span:not(.setup-side-portrait){min-width:0}
.setup-side-tabs small{display:block;font-size:9px;color:#8fa9b5}
.setup-side-tabs strong{font-size:13px;font-weight:500;color:#e1dec9}
.setup-side-tabs b{font-size:11px;font-weight:400;color:#b2c8ca;margin-left:auto;white-space:nowrap}
.setup-side-portrait{display:block;width:35px;height:35px;flex:0 0 35px;background-size:400% 200%;border:1px solid #71868a;background-color:#1b303c}
.setup-commander-layout{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(240px,1fr);gap:18px;align-items:start}
.setup-commander-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.setup-commander-grid>button{display:flex;align-items:center;gap:12px;border:1px solid #425d6a;background:#11202c;padding:10px;text-align:left;min-height:82px}
.setup-commander-grid>button[aria-pressed=true]{border-color:#c6ad76;background:#63533738;box-shadow:inset 3px 0 #c6ad76}
.setup-portrait{display:block;width:59px;height:59px;flex:0 0 59px;background-size:400% 200%;background-color:#192b38;border:1px solid #6c8188}
.setup-commander-grid small{display:block;font-size:9px;color:#9bb2b7;margin-bottom:4px}
.setup-commander-grid strong{display:block;font-size:13px;color:#e2ddc9;font-weight:500;line-height:1.5}
.setup-commander-grid em{display:block;font-size:10px;font-style:normal;color:#9cb9bd;margin-top:4px}
.setup-doctrine{background:linear-gradient(150deg,#1a2d37,#101b28);padding:20px;border:1px solid #56707b;min-width:0}
.setup-doctrine>small{font-size:9px;letter-spacing:2px;color:#86a4af}
.setup-doctrine h3{font-size:23px;font-weight:400;margin:8px 0;color:#ebd8aa}
.setup-flagship{font-size:11px;color:#a7bcc2;margin:0 0 14px}
.doctrine-traits{display:flex;gap:5px;flex-wrap:wrap}
.doctrine-traits span{font-size:10px;padding:4px 7px;background:#7ca5a81b;border:1px solid #7ca5a83b;color:#b9d3d1;line-height:1.4}
.setup-doctrine dl{margin:18px 0 0}
.setup-doctrine dt{font-size:10px;color:#c8b784;margin-top:14px}
.setup-doctrine dd{font-size:12px;line-height:1.8;margin:4px 0;color:#bccbd0}
.setup-canon{margin-top:17px;border-top:1px solid #6b82883a;padding-top:11px;font-size:10px;color:#8faab8}
.setup-canon summary{cursor:pointer;min-height:24px}
.setup-canon p{line-height:1.8;margin:7px 0}.setup-canon a{font-size:10px}
.fleet-workbench{margin:0}
.fleet-workbench .fleet-side{padding:14px}
.fleet-setup-top{display:grid;grid-template-columns:1.35fr 1fr;gap:18px;align-items:end}
.setup-field-label{display:block;font-size:10px;color:#abc3ca;margin-bottom:6px}
.fleet-workbench .fleet-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
.fleet-workbench .fleet-presets button{font-size:10px;line-height:1.5;padding:5px;min-height:39px}
.fleet-workbench .fleet-total-controls{margin:0;gap:10px}
.fleet-workbench select,.fleet-workbench input{min-height:36px;padding:6px;font-size:12px}
.fleet-team-presets{display:flex;align-items:center;gap:7px;margin:11px 0;padding:8px 0;border-top:1px solid #53717b3b;border-bottom:1px solid #53717b3b}
.fleet-team-presets>span{font-size:10px;color:#b5c9cc;flex-shrink:0}
.fleet-team-presets button{border:1px solid #777c5b;padding:6px 11px;font-size:10px;color:#ddd1a4;min-height:32px}
.fleet-team-presets>small{font-size:9px;color:#7e9ca9;margin-left:auto}
.fleet-unit-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin-bottom:12px}
.fleet-unit-tabs>button{display:flex;align-items:center;gap:9px;text-align:left;background:#10212b;border:1px solid #4c6672;padding:8px;min-height:64px}
.fleet-unit-tabs>button[aria-pressed=true]{border-color:#c6ac6e;background:#57502f3d}
.fleet-unit-portrait{display:block;width:38px;height:42px;flex:0 0 38px;background-size:400% 200%;border:1px solid #607b84}
.fleet-unit-tabs strong{display:block;font-size:11px;font-weight:500;color:#e0d8b9;line-height:1.5}
.fleet-unit-tabs small{display:block;font-size:9px;color:#9bb4c0;max-width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.fleet-unit-tabs b{display:block;font-size:10px;font-weight:400;color:#9fc9cb;margin-top:4px}
.fleet-unit-editor{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:20px;padding:12px;background:#091923;border:1px solid #46636f}
.fleet-unit-fields{display:grid;grid-template-columns:90px minmax(0,1fr);gap:9px 14px}
.fleet-unit-fields .fleet-officer-field{grid-column:1/-1}
.fleet-unit-fields label{font-size:10px}
.fleet-unit-fields label>small{display:block;font-size:9px;color:#839da8;line-height:1.5;margin-top:4px}
.fleet-unit-fields .fleet-chief{font-size:12px;min-height:35px;margin-top:5px;border:1px solid #52666d;padding:5px 8px;background:#192b33}
.fleet-officer-brief{display:flex;gap:12px;align-items:flex-start;min-width:0}
.fleet-edit-portrait{display:block;width:65px;height:65px;flex:0 0 65px;background-size:400% 200%;border:1px solid #6c8188}
.fleet-officer-brief>div{min-width:0}
.fleet-officer-brief strong{font-size:13px;font-weight:500;color:#e3d2a2}
.fleet-officer-brief p{font-size:12px;line-height:1.7;color:#b6cbd0;margin:5px 0 8px}
.fleet-officer-brief small{display:block;font-size:10px;line-height:1.7;color:#a99585;margin-top:8px}
.fleet-workbench-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:9px}
.fleet-workbench-footer .fleet-keep-formation{margin:0;font-size:11px}
.fleet-workbench-footer .quiet-button{font-size:10px;min-height:31px;padding:5px 10px;border:1px solid #526e73}
.fleet-workbench .deploy-notice{margin:7px 0 0;font-size:10px;line-height:1.6;min-height:16px}
.custom-workspace .deployment-editor{margin:0;padding:12px 14px}
.custom-workspace .deploy-heading{margin-bottom:9px}
.custom-workspace .deploy-heading h4{font-size:18px;margin:2px 0}
.custom-workspace .deploy-heading small{font-size:8px}
.custom-workspace .deploy-heading>span{font-size:10px}
.custom-workspace .deploy-presets{margin-bottom:10px}
.custom-workspace .deploy-presets button{min-height:34px;padding:6px 12px;font-size:11px}
.custom-workspace .deploy-body{grid-template-columns:minmax(0,1fr) 285px;gap:17px;align-items:start}
.custom-workspace .deployment-chart{max-height:305px;width:100%;object-fit:contain}
.custom-workspace .deploy-controls{display:grid;grid-template-columns:1fr 1fr;gap:8px 12px}
.custom-workspace .deploy-controls label{font-size:10px;min-width:0}
.custom-workspace .deploy-controls label:first-child,.custom-workspace .deploy-controls label:has([data-deploy-flagship]),.custom-workspace .deploy-controls label:has([data-deploy-enemy]){grid-column:1/-1}
.custom-workspace .deploy-controls select{font-size:11px;min-height:34px;padding:5px;margin-top:3px}
.custom-workspace .deploy-controls input[type=range]{min-height:24px;margin-top:3px}
.custom-workspace .deploy-axis-hint{display:none}
.custom-workspace .deploy-station-note{grid-column:1/-1;margin:0;font-size:9px}
.custom-workspace .deploy-map>p{font-size:9px;margin:5px 0}
.custom-workspace .deploy-actions{margin-top:8px}
.custom-workspace .deploy-actions button{min-height:32px;padding:5px 10px;font-size:10px}
.custom-workspace .deploy-notice{font-size:10px;margin-top:6px;line-height:1.6}
.custom-workspace .deploy-disclaimer{font-size:9px;margin-top:4px;line-height:1.5}
.setup-review-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.setup-review-side{padding:18px;background:#13232e;border:1px solid #526c78}
.setup-review-side header{display:flex;align-items:center;gap:13px}
.setup-review-side header small{font-size:10px;color:#9bb4c0}
.setup-review-side h3{font-size:21px;font-weight:400;margin:4px 0;color:#e7d5a9}
.setup-review-side header p{font-size:12px;color:#b1c9cc;margin:5px 0}
.setup-review-side ul{list-style:none;padding:0;margin:16px 0 0}
.setup-review-side li{display:flex;justify-content:space-between;align-items:center;gap:12px;border-top:1px solid #607a833b;padding:10px 0;font-size:12px;color:#d0d9d9}
.setup-review-side li small{display:block;color:#91abb5;font-size:10px;margin-top:4px}
.setup-review-side li b{font-weight:400;color:#cbba8d}
.setup-review-note{font-size:10px;color:#92aab6;line-height:1.8;margin:8px 0 0}
.setup-launch-rules{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:16px 0 4px}
.setup-launch-rules label{font-size:11px;color:#bacbd0}
.setup-launch-rules select{display:block;background:#122632;border:1px solid #617d88;color:#ded8be;min-height:36px;padding:6px;font:inherit;margin-top:5px}
.setup-check{display:flex;align-items:center;gap:7px}
.custom-workspace input[type=checkbox]{accent-color:#d4be82}
.custom-workspace button:focus-visible,.custom-workspace select:focus-visible,.custom-workspace input:focus-visible{outline:2px solid #e9cf8c;outline-offset:2px}
@media(max-width:900px){
 .setup-commander-layout{grid-template-columns:1.4fr 1fr;gap:12px}
 .setup-doctrine{padding:15px}.setup-doctrine h3{font-size:20px}
 .setup-commander-grid>button{padding:8px;gap:8px}.setup-commander-grid .setup-portrait{width:44px;height:48px;flex-basis:44px}
 .setup-commander-grid strong{font-size:11px}.setup-commander-grid em{font-size:9px}
 .fleet-unit-tabs>button{gap:6px}.fleet-unit-portrait{width:29px;height:34px;flex-basis:29px}
 .fleet-officer-brief .fleet-edit-portrait{display:none}
 .fleet-team-presets>small{display:none}
}
@media(max-width:620px){
 #modal:has(.custom-workspace){width:calc(100vw - 10px);height:96dvh;max-height:96dvh}
 #modal:has(.custom-workspace) .modal-top{padding:8px 13px;min-height:34px}
 #modal:has(.custom-workspace) #modal-content{padding:10px;height:calc(100% - 40px)}
 .custom-workspace{gap:9px}
 .setup-heading{gap:7px}.setup-heading>div>small{font-size:7px;letter-spacing:1px}
 .setup-heading .modal-title{font-size:16px;line-height:1.5;margin-top:3px}
 .setup-heading .war-tabs button{padding:7px 9px;font-size:10px;min-height:34px}
 .setup-steps{gap:4px}.setup-steps button{padding:9px 6px;gap:5px;justify-content:center}
 .setup-steps button b{font-size:10px}.setup-steps button span{font-size:10px}
 .setup-side-tabs{gap:6px;margin-bottom:10px}
 .setup-side-tabs>button{padding:7px;gap:7px;min-height:51px}
 .setup-side-portrait{width:29px;height:31px;flex-basis:29px}
 .setup-side-tabs strong{font-size:10px}.setup-side-tabs small{font-size:8px}.setup-side-tabs b{font-size:8px}
 .setup-commander-layout{grid-template-columns:1fr;gap:10px}
 .setup-commander-grid{gap:6px}
 .setup-commander-grid>button{min-height:65px;padding:7px}
 .setup-commander-grid .setup-portrait{width:40px;height:44px;flex-basis:40px}
 .setup-commander-grid small{font-size:8px;margin-bottom:2px}.setup-commander-grid strong{font-size:10px}
 .setup-commander-grid em{font-size:8px;margin-top:2px}
 .setup-doctrine{padding:11px 12px}.setup-doctrine>small,.setup-doctrine h3,.setup-flagship,.setup-doctrine .doctrine-traits,.setup-canon{display:none}
 .setup-doctrine dl{margin:0;display:grid;grid-template-columns:65px 1fr;gap:5px 8px}
 .setup-doctrine dt{font-size:9px;margin:0;line-height:1.7}.setup-doctrine dd{font-size:10px;margin:0;line-height:1.7}
 .setup-footer{gap:8px;padding-top:8px;min-height:49px}
 .setup-footer-summary strong{font-size:16px}.setup-footer-summary small{font-size:8px}
 .setup-footer-actions{gap:5px}.setup-footer-actions .quiet-button{font-size:10px;padding:5px;min-height:36px}
 .setup-footer-actions .primary-button{font-size:11px;padding:8px 12px;min-height:39px}
 .setup-quick-launch{display:none}
 .fleet-workbench .fleet-side{padding:10px}
 .fleet-setup-top{grid-template-columns:1fr;gap:9px}
 .fleet-workbench .fleet-presets button{font-size:9px;min-height:32px;padding:4px 2px}
 .setup-field-label{font-size:9px;margin-bottom:4px}
 .fleet-workbench .fleet-total-controls{gap:9px}.fleet-workbench .fleet-total-controls label{font-size:10px}
 .fleet-workbench select,.fleet-workbench input{min-height:34px;font-size:11px;padding:5px}
 .fleet-team-presets{gap:5px;margin:8px 0;padding:7px 0}
 .fleet-team-presets>span{font-size:9px}.fleet-team-presets button{font-size:9px;padding:5px 7px;min-height:30px}
 .fleet-unit-tabs{gap:4px;margin-bottom:9px}.fleet-unit-tabs>button{display:block;padding:6px 3px;text-align:center;min-height:62px}
 .fleet-unit-portrait{display:none}.fleet-unit-tabs strong{font-size:10px}.fleet-unit-tabs small{font-size:8px}.fleet-unit-tabs b{font-size:9px}
 .fleet-unit-editor{grid-template-columns:1fr;gap:10px;padding:10px}
 .fleet-unit-fields{grid-template-columns:70px 1fr;gap:7px 10px}.fleet-unit-fields label{font-size:10px}.fleet-unit-fields label>small{font-size:8px}
 .fleet-officer-brief strong{font-size:11px}.fleet-officer-brief p{font-size:10px;margin:4px 0;line-height:1.6}
 .fleet-officer-brief .doctrine-traits{display:none}.fleet-officer-brief small{font-size:9px;line-height:1.6;margin-top:5px}
 .fleet-workbench-footer{margin-top:8px}.fleet-workbench-footer .fleet-keep-formation{font-size:10px}
 .fleet-workbench-footer .quiet-button{font-size:9px;padding:5px 7px}
 .fleet-workbench .deploy-notice{font-size:9px;margin-top:5px}
 .custom-workspace .deployment-editor{padding:8px 10px}
 .custom-workspace .deploy-heading h4{font-size:15px}.custom-workspace .deploy-heading>span{display:none}
 .custom-workspace .deploy-presets{gap:4px}.custom-workspace .deploy-presets button{font-size:9px;padding:5px 2px;min-height:32px}
 .custom-workspace .deploy-body{grid-template-columns:1fr;gap:6px}
 .custom-workspace .deployment-chart{max-height:218px}
 .custom-workspace .deploy-map>p{font-size:8px;margin:4px 0}
 .custom-workspace .deploy-controls{grid-template-columns:1fr 1fr;gap:6px 10px}
 .custom-workspace .deploy-controls label:first-child{grid-column:auto}
 .custom-workspace .deploy-controls label:has([data-deploy-formation]){grid-column:2;grid-row:1}
 .custom-workspace .deploy-controls label:has([data-deploy-flagship]),.custom-workspace .deploy-controls label:has([data-deploy-enemy]){grid-column:auto}
 .custom-workspace .deploy-controls select{font-size:10px;min-height:32px}
 .custom-workspace .deploy-station-note{display:none}
 .custom-workspace .deploy-actions{margin-top:6px;gap:5px}
 .custom-workspace .deploy-actions button{min-height:30px;min-width:0;font-size:9px;padding:5px}
 .custom-workspace .deploy-notice{font-size:9px;line-height:1.5}.custom-workspace .deploy-disclaimer{display:none}
 .setup-review-grid{gap:8px}.setup-review-side{padding:10px}
 .setup-review-side header{gap:7px}.setup-review-side .setup-portrait{width:30px;height:34px;flex-basis:30px}
 .setup-review-side h3{font-size:12px;margin:3px 0}.setup-review-side header small{font-size:8px}.setup-review-side header p{font-size:9px;margin:3px 0}
 .setup-review-side ul{margin-top:10px}.setup-review-side li{font-size:10px;padding:8px 0;gap:5px}
 .setup-review-side li small{font-size:8px;line-height:1.5}
 .setup-review-side li b{font-size:10px}.setup-review-note{font-size:9px}
 .setup-launch-rules{display:grid;grid-template-columns:1fr;gap:13px;padding-top:13px}
 .setup-launch-rules>label:first-child{display:flex;align-items:center;justify-content:space-between;gap:10px}
 .setup-launch-rules label{font-size:10px}.setup-launch-rules select{font-size:11px;margin:0;min-height:34px}
}
@media(max-height:690px) and (min-width:621px){
 #modal:has(.custom-workspace){height:96dvh;max-height:96dvh}
 .custom-workspace{gap:8px}.setup-heading .modal-title{font-size:20px}.setup-heading>div>small{display:none}
 .setup-steps button{padding:8px 12px}
 .setup-commander-grid>button{min-height:65px;padding:7px}.setup-commander-grid .setup-portrait{width:43px;height:43px;flex-basis:43px}
 .setup-side-tabs{margin-bottom:8px}.setup-side-tabs>button{min-height:46px;padding:5px 10px}
 .setup-doctrine{padding:14px}.setup-doctrine dl{margin-top:10px}.setup-doctrine dt{margin-top:8px}
 .custom-workspace .deployment-chart{max-height:250px}
 .fleet-workbench .fleet-side{padding:10px}.fleet-team-presets{margin:7px 0;padding:5px 0}
 .fleet-unit-tabs{margin-bottom:8px}.fleet-unit-tabs>button{min-height:54px;padding:5px 8px}
 .fleet-unit-editor{padding:9px}
}
/* Keep the dialog footer in view without assumptions about header height. */
#modal[open]:has(.custom-workspace){display:flex;flex-direction:column}
#modal:has(.custom-workspace) .modal-top{flex:0 0 auto}
#modal:has(.custom-workspace) #modal-content{flex:1;height:auto;min-height:0}
.fleet-workbench .fleet-side{padding:10px}
.fleet-team-presets{margin:7px 0;padding:6px 0}
.fleet-unit-tabs{margin-bottom:9px}
.fleet-unit-tabs>button{min-height:58px;padding:6px 8px}
.fleet-unit-editor{padding:10px}
.fleet-unit-fields label>small{line-height:1.3;margin-top:2px}
.custom-workspace .deployment-chart{width:min(100%,465px);max-height:none;margin-inline:auto}
@media(max-width:620px){
 .fleet-unit-tabs>button{padding:5px 3px;min-height:59px}
 .fleet-workbench .fleet-side{padding:8px}
 .fleet-unit-editor{padding:8px}
 .fleet-officer-brief small{display:none}
 .custom-workspace .deployment-chart{width:min(100%,327px)}
}
@media(max-height:690px) and (min-width:621px){
 .custom-workspace .deployment-chart{width:min(100%,375px)}
}

.fleet-workbench .setup-side-tabs{margin-bottom:10px}
.fleet-workbench-footer{margin-top:6px}
.fleet-workbench>.deploy-notice{margin-top:3px}
