/* MOONbase 5.1: same industrial controls, variable workflow lengths. */
body .moon-card .job-progress-bar, .job-progress-bar.labeled-progress {
  grid-template-columns:none!important;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);
}
.workflow-slot-grid,.workflow-card-preview,.workflow-palette-settings{grid-template-columns:repeat(9,minmax(70px,1fr))!important}
.workflow-template-card,.workflow-palette-settings{min-width:860px}
#workflow-settings-form{overflow-x:auto}
.station-filter-row{grid-template-columns:160px!important;grid-auto-flow:column;grid-auto-columns:minmax(70px,1fr);min-width:860px}
.settings-view-departments .department-color-settings,.department-color-settings{grid-template-columns:repeat(10,minmax(92px,1fr))!important;min-width:1020px}
.department-color-fields{overflow-x:auto}
.role-permission-head,.role-permission-row{grid-template-columns:110px 65px repeat(13,minmax(62px,1fr))!important}
.settings-station-links{display:block!important;padding:12px!important}
.settings-station-links h3{margin:0 0 10px;color:var(--amber)}
.station-link-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.station-link-card{display:flex;gap:10px;align-items:center;padding:8px 10px;border:1px solid var(--steel);border-radius:4px;background:var(--panel-2);min-width:0}
.station-link-card>a,.station-link-card>span{flex:1;min-width:0;text-decoration:none;font:700 .8rem var(--mono);color:var(--text);overflow-wrap:anywhere}
.station-link-card label{display:flex;gap:5px;align-items:center;white-space:nowrap;font-size:.7rem;color:var(--muted)}
.station-link-card input{width:auto;margin:0}
.station-link-card.is-disabled>span{color:var(--muted)}
.station-link-card button{min-width:46px!important;padding:6px 8px!important}
.settings-live-consoles>.backup-restore-console{grid-column:1/-1;width:auto;margin:0!important}
.backup-restore-console p{font-size:.8rem;line-height:1.5;color:var(--muted)}
.backup-action-grid label{display:inline-grid;gap:6px;margin-right:8px;font:600 .7rem var(--mono);color:var(--muted)}
.backup-action-grid button{margin-top:8px}
.backup-restore-console>h3{margin-top:0;border-bottom:1px solid var(--steel);padding-bottom:10px}
.calendar-week-toolbar{display:grid!important;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)!important;align-items:center;gap:8px}
#company-week-label{text-align:center!important}
#company-prev-week{justify-self:start}#company-current-week,#company-next-week{justify-self:end}
.command-board-weather .weather-inline-head,.command-board-weather .weather-forecast,.command-board-weather .forecast-strip{border:0!important}
#v5-leave-controls [data-management-note]{text-transform:none!important}
#v5-leave-controls .sick-day-button{text-transform:none!important}
.job-notes strong{color:var(--amber)}
.moon-state[data-state="bid"]{--state-color:var(--amber)!important;color:var(--amber)!important;border-color:var(--amber)!important}
.moon-task:has(>.task-card-actions){display:grid!important;grid-template-columns:minmax(0,1fr) 130px!important;gap:0 10px}
.moon-task>.task-card-main{min-width:0}
.moon-task>.task-card-main>.task-card-head{display:block!important}
.moon-task>.task-card-actions{grid-column:2;grid-row:1;display:flex;flex-direction:column;align-items:stretch;gap:5px;border-left:1px solid var(--steel);padding-left:10px;min-width:0}
.moon-task>.task-card-actions button{width:100%;min-width:0}
#open-assets{margin-left:auto}
.enterprise-entry{font-size:.65rem!important;white-space:nowrap}
.enterprise-entry[data-enterprise="Estimates"]{margin-left:auto}
.enterprise-workspace-dialog{max-height:85vh;overflow:auto}
[data-resource-open],.employee-document-link{border:0!important;background:transparent!important;box-shadow:none!important;text-decoration:none!important;color:var(--text)!important;text-align:left;padding:5px 0!important;font-weight:600;cursor:pointer}
[data-resource-open]:hover,.employee-document-link:hover{color:var(--amber)!important}
[data-resource-open]:focus-visible,.employee-document-link:focus-visible{outline:2px solid var(--amber);outline-offset:3px}
.worklog-group{border-top:1px solid var(--steel);margin:12px 0;padding-top:10px}
.worklog-group>summary{font-size:.9rem;font-weight:700;color:var(--heading);cursor:pointer;padding:4px 0 10px}
.employee-roster .user-roster-row,.employee-roster-head{grid-template-columns:minmax(140px,2fr) minmax(100px,1fr) 90px 150px!important}
.employee-profile-access{border:1px solid var(--steel);padding:14px;display:grid;gap:12px;margin:10px 0}
.employee-profile-access legend{font:700 .7rem var(--mono);color:var(--muted);text-transform:uppercase;padding:0 6px}
.payroll-chart-grid{grid-template-columns:minmax(230px,1.6fr) minmax(145px,1fr) minmax(145px,1fr)!important}
@media(max-width:1050px){.station-link-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.payroll-chart-grid{grid-template-columns:1fr 1fr!important}.payroll-chart-grid>section:first-child{grid-column:1/-1}}
@media(max-width:650px){.station-link-grid{grid-template-columns:1fr}.calendar-week-toolbar{grid-template-columns:1fr auto auto!important}.calendar-week-toolbar>strong{grid-column:1/-1;grid-row:1}.moon-task:has(>.task-card-actions){grid-template-columns:minmax(0,1fr) 95px!important}.employee-roster-head{display:none!important}.employee-roster .user-roster-row{grid-template-columns:1fr auto!important}.payroll-chart-grid{grid-template-columns:1fr!important}.payroll-chart-grid>section:first-child{grid-column:auto}}

.calendar-week-actions{display:flex;gap:8px;justify-self:end;align-items:center}

#settings-live-group .settings-live-consoles>.backup-restore-console{grid-area:auto!important;grid-column:1/-1!important;grid-row:auto!important;order:100;max-width:none!important;width:100%!important}
.job-priority-toggle,.task-secondary-filters>.inline-check{text-transform:uppercase}
.brand-lockup .overline{text-transform:none}
/* v5.1.1 review corrections */
body .moon-task>.task-card-actions{border-left:0!important;padding-left:0!important}
body .moon-task .task-card-info{border-top:0!important}
.enterprise-header-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin-left:auto}
body #jobs-card>.card-head>.enterprise-header-actions,body #shop-notes-card>.card-head>.enterprise-header-actions{display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;gap:8px}
body .card-head .enterprise-header-actions>.enterprise-entry{font:700 .75rem var(--mono)!important;padding:7px 10px!important;min-height:30px;background:var(--panel-2)!important;border:1px solid var(--steel)!important;border-radius:4px;letter-spacing:.03em}
.enterprise-header-actions #open-assets,.enterprise-header-actions .enterprise-entry[data-enterprise="Estimates"]{margin-left:0}
body #employee-resource-accordion a.resource-open{display:inline-block!important;border:0!important;background:transparent!important;box-shadow:none!important;text-decoration:none!important;padding:5px 0!important;min-width:0!important;color:var(--text)!important;font-weight:600}
body #employee-resource-accordion a.resource-open:hover{color:var(--amber)!important;text-decoration:underline!important}
.employee-profile-access>.form-grid{width:100%}
.employee-profile-form .form-grid>label{min-width:0}
.role-permission-row .permission-required input{accent-color:#f2c13e;opacity:1!important;filter:none}
.role-permission-row .permission-optional input{accent-color:#2581ed}
.role-permission-row label[hidden]{display:block!important;visibility:hidden}
.permission-legend{display:flex;justify-content:flex-end;gap:15px;font-size:.7rem;margin-top:10px}
.permission-key{display:inline-flex;align-items:center;gap:7px}
.permission-key:before{content:"";width:14px;height:14px;background:#2581ed;display:inline-block}
.permission-key.is-required:before{background:#f2c13e}
.role-permission-row input[type="checkbox"]{appearance:none!important;position:relative;width:16px!important;height:16px!important;margin:0!important;padding:0!important;border:1px solid #2581ed!important;border-radius:1px!important;background:#2581ed!important;opacity:1!important;filter:none!important}
.role-permission-row .permission-required input[type="checkbox"]{background:#f2c13e!important;border-color:#f2c13e!important}
.role-permission-row input[type="checkbox"]:checked:after{content:"";position:absolute;left:5px;top:1px;width:4px;height:9px;border:solid white;border-width:0 2px 2px 0;transform:rotate(45deg)}
.role-permission-row .permission-required input[type="checkbox"]:checked:after{border-color:#313b41}
.role-permission-row input[type="checkbox"]:focus-visible{outline:2px solid var(--text);outline-offset:3px}
body .command-board-weather .weather-inline-head{border-bottom:1px solid var(--steel)!important}
body.moon-app-page #weather-panel strong.weather-temp{font-size:clamp(30px,2.5vw,38px)!important;line-height:1.1!important}
.command-board-weather .weather-split{display:grid!important;grid-template-columns:minmax(90px,1fr) auto!important;gap:16px!important}
.command-board-weather .weather-forecast{justify-self:end;text-align:right}
.workspace-footer-actions>[data-workspace-tab="history"]{margin-right:auto}
.workspace-recovery-actions{margin-right:8px!important;flex:0 0 auto!important}
body .moon-card .job-progress-segment{padding-inline:2px!important}
body .moon-card .job-progress-segment i{white-space:nowrap!important;overflow:hidden;text-overflow:ellipsis;max-width:100%}
body .card-head .enterprise-entry{text-transform:uppercase}
@media(max-width:650px){.enterprise-header-actions{width:100%;justify-content:flex-end}.command-board-weather .weather-temp{font-size:2rem!important}.employee-profile-access>.form-grid{grid-template-columns:1fr}.permission-legend{justify-content:flex-start}}
@media(max-width:650px){
 .app-nav{display:flex!important;flex-wrap:nowrap!important;gap:4px!important}
 .app-nav .nav-tab{font-size:.6rem!important;padding:8px 4px!important;min-width:0!important;flex:1 1 auto!important}
 .app-nav [aria-label="Settings"]{width:30px!important;min-width:30px!important;flex:0 0 30px!important}
 .app-nav [aria-label="Settings"]{justify-content:center;display:inline-flex}
 #jobs-card>.card-head,#shop-notes-card>.card-head{display:flex!important;flex-wrap:wrap;gap:6px;justify-content:flex-start}
 #jobs-card>.card-head>div,#shop-notes-card>.card-head>div{flex:1 1 100%}
 .enterprise-entry[data-enterprise="Estimates"]{margin-left:0}
 #jobs-card #open-receiving{flex:1 1 auto}
 body .moon-card .job-progress-bar{grid-auto-columns:minmax(62px,1fr)!important;overflow-x:auto!important;max-width:100%;padding-bottom:4px}
 body .moon-card .job-progress-segment i{white-space:nowrap!important;word-break:normal!important;font-size:.6rem!important}
}

@media(max-width:650px){
 #app-shell .app-nav .nav-tab{min-width:0!important}
 #app-shell #jobs-card>.card-head.module-title-actions,#app-shell #shop-notes-card>.card-head.module-title-actions{flex-direction:row!important}
 #app-shell #jobs-card>.card-head>.enterprise-entry,#app-shell #shop-notes-card>.card-head>.enterprise-entry{width:auto!important;flex:0 0 auto!important;display:inline-flex!important}
}

@media(max-width:650px){body #jobs-card .enterprise-header-actions #open-receiving{flex:1 1 100%}body .enterprise-header-actions .enterprise-entry{flex:1 1 auto}}
