/* UX-P8 UI normalization. Apply after the existing base CSS, no new dependencies. */
:root{--p8-control:44px;--p8-gap:10px}
/* Safari native selects must have an explicit height, padding and text treatment. */
.content :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]),select),
body dialog :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]),select){
 box-sizing:border-box;min-height:var(--p8-control);height:var(--p8-control);font-size:13px;line-height:20px;border-radius:6px;min-width:0;
}
.content select,body dialog select{appearance:none;-webkit-appearance:none;padding:0 34px 0 12px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23b5c7b9' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;background-size:13px}
.content :is(button.primary,button.secondary),body dialog :is(button.primary,button.secondary){min-height:var(--p8-control);line-height:1.25;padding:9px 14px}
.content :is(button.quiet,button.page-number){min-height:var(--p8-control)}
.content .toolbar{display:flex;gap:var(--p8-gap);align-items:stretch;flex-wrap:wrap}
.content .toolbar>select{flex:0 1 175px;width:auto;max-width:none}
.content .toolbar>label{min-height:var(--p8-control);display:inline-flex;align-items:center}
.search-field{display:inline-flex;align-items:stretch;flex:1 1 275px;min-width:225px;gap:8px;max-width:none}
.search-field>input[type=search]{flex:1 1 auto;width:100%;min-width:0;margin:0;max-width:none}
.search-field .search-action{flex:0 0 auto;min-width:72px}
.content :is(#projectSearch,#ideaSearch,#oppSearch,#documentSearch,#resourceSearch){width:100%}
.project-search-toolbar{display:grid!important;grid-template-columns:minmax(275px,1fr) repeat(3,minmax(140px,180px));gap:12px!important}
.project-search-toolbar>.search-field{min-width:0}
.project-search-toolbar>select{width:100%!important;max-width:none!important}
#ideasView>.toolbar,#opportunitiesView>.toolbar,#documentsView>.toolbar,#resourcesView .resource-filter{display:grid;grid-template-columns:minmax(280px,1fr) repeat(3,minmax(140px,180px));gap:12px}
#ideasView>.toolbar>select,#opportunitiesView>.toolbar>select,#documentsView>.toolbar>select,#resourcesView .resource-filter>select{width:100%;max-width:none}
#opportunitiesView>.toolbar{grid-template-columns:minmax(270px,1fr) minmax(155px,195px)}
#documentsView>.toolbar{grid-template-columns:minmax(265px,1fr) repeat(2,minmax(150px,200px)) auto}
#resourcesView .resource-filter{grid-template-columns:minmax(245px,1fr) minmax(150px,180px) auto auto}
.list-controls{margin-top:18px;align-items:center;gap:12px;min-height:var(--p8-control)}
.list-controls .project-list-actions,.list-controls .view-switch{display:flex;align-items:center;gap:8px}
.list-controls label{display:inline-flex;align-items:center;gap:9px;margin:0}
.list-controls label select{min-width:96px;max-width:100px;height:var(--p8-control);margin:0}
.list-footer{display:flex;justify-content:flex-end;margin:18px 0 30px;padding-top:14px;border-top:1px solid #343e37}
.list-footer>button{min-width:88px}
.pager{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px;margin:20px 0 12px}
.pager button{height:38px;min-height:38px!important;min-width:36px;padding:7px 11px;font-size:12px;border-radius:6px}
.pager button.current{background:#425f4c;color:#f5fff6;border:1px solid #9dbfa7;font-weight:700;cursor:default}
.pager button.quiet{border:1px solid #3a4840;background:#202723;color:#b6c7ba}
.pager button:disabled:not(.current){opacity:.38}
.pager-compact{margin:10px 0 16px}.pager-compact button{height:32px;min-height:32px!important;padding:4px 8px;min-width:31px}
/* Projects: compact list, balanced cards, stage clearly separated. */
.project-list-rows{gap:8px}
.project-list-rows .project-row-compact{display:grid;grid-template-columns:36px minmax(170px,1.05fr) minmax(230px,.95fr);column-gap:18px;align-items:center;min-height:94px;padding:13px 17px;text-align:left;overflow:hidden}
.project-row-compact .project-row-summary{min-width:0;display:flex;flex-direction:column;gap:4px}
.project-row-compact .list-sequence{align-self:start;font-size:13px;color:#97a99b;font-variant-numeric:tabular-nums;padding-top:5px}
.project-row-compact .meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0;order:2}
.project-row-compact h3{font-size:15px;line-height:1.35;margin:0;order:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.project-row-compact p{font-size:11px;line-height:1.4;margin:0;order:1;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.project-list-rows .stage-track{margin:0;width:100%;max-width:none;gap:0}
.project-list-rows .stage-node{font-size:10px;gap:7px}
.project-list-rows .stage-dot{width:12px;height:12px}
.project-list-rows .stage-node:not(:last-of-type):after{top:5px}
.project-card-grid .item-card{display:flex;flex-direction:column;min-height:194px;padding:16px 19px}
.project-card-grid .item-card .meta{display:flex;align-items:center;flex-wrap:wrap;gap:7px;margin:5px 0}
.project-card-grid .item-card h3{margin:6px 0;font-size:16px}
.project-card-grid .item-card p{margin:3px 0;line-height:1.45;min-height:32px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.project-card-grid .stage-track{margin:auto 0 4px;width:100%;max-width:none;padding-top:12px}
/* Project overview stays inside the same navigation as every linked section. */
.project-context{padding:18px 20px 12px;margin-bottom:26px}
.project-context-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.project-context-head strong{margin:0;font-size:17px}
.project-context-stage .stage-track{max-width:none;margin:16px 0 14px;width:100%;padding:2px 4px}
.project-context-tabs{margin:12px 0 2px;display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:5px}
.project-context-tabs button{padding:10px 4px;min-width:0;white-space:nowrap;text-align:center;min-height:42px;font-size:11px}
.stage-link{border:none;background:transparent;padding:0;cursor:pointer;font:inherit;min-height:30px;color:inherit}
.stage-link:hover .stage-name,.stage-link:focus-visible .stage-name{color:#d5f3df;text-decoration:underline}
.stage-link:focus-visible{outline:2px solid #8ec6a1;outline-offset:2px;border-radius:5px}
.project-hub .stage-track{max-width:none;width:100%;margin:24px 0}
.project-hub>.meta{display:flex;align-items:center;gap:10px}
.project-hub>.action-row,.project-hub>.project-status-control{justify-content:space-between}
.project-hub>.secondary{margin:10px 0 16px}
.project-hub .workflow-editor{padding:15px;gap:10px;margin:12px 0 24px}
.project-hub .workflow-editor select{flex:1 1 140px}
.project-danger-footer{display:flex;justify-content:flex-end;align-items:center;margin:28px 0 0;padding:16px 0 0;border-top:1px solid #364339}
.project-danger-footer button{min-width:80px}
/* Unified compact forms and centered modals, including tabbed opportunities. */
body dialog{margin:auto;border-radius:9px;max-height:92dvh;max-width:calc(100vw - 28px)}
body dialog:not(.workspace-dialog):not(.wide-dialog):not(.lookup-dialog){width:min(94vw,620px)}
body dialog .form-panel{width:100%;max-width:none}
body dialog .two{gap:15px;align-items:start}
body dialog .two>div{min-width:0}
body dialog .two>div>label{display:block;margin:0 0 8px}
body dialog .two :is(select,input){width:100%;max-width:none}
body dialog .form-panel .two+label{margin-top:18px}
body dialog .form-panel :is(textarea){max-width:100%;width:100%}
body dialog .dialog-actions{margin-top:24px;gap:10px}
#ideaDetailDialog .detail-panel>.meta{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#ideaDetailDialog .detail-panel>form{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:16px 0 30px}
#ideaDetailDialog .detail-panel>form>textarea{width:100%;min-height:124px}
#ideaDetailDialog .detail-panel>.two-controls{display:flex;align-items:stretch;justify-content:flex-end;gap:10px;margin:14px 0}
#ideaDetailDialog .detail-panel>.two-controls>.project-lookup-field{flex:1 1 auto;max-width:none}
#ideaDetailDialog .detail-panel>.two-controls>button{flex:0 0 96px}
.opportunity-workspace-dialog{width:min(95vw,1050px);max-width:1050px;max-height:90dvh}
.opportunity-workspace-dialog .detail-panel{min-height:510px;width:100%;max-width:none;margin:0 auto;padding:22px 28px}
.opportunity-workspace-dialog .opp-edit{width:100%;max-width:100%;margin:0 auto}
.opportunity-workspace-dialog .opp-data-grid{align-items:start;gap:16px}
.opportunity-workspace-dialog .opp-data-grid>*{min-width:0}
.opp-form,.review-create-dialog{width:min(94vw,690px);max-width:690px}
.review-card-grid .item-card,.document-card-grid .item-card{height:190px;max-height:190px;overflow:hidden;display:flex;flex-direction:column}
.review-card-grid .item-card :is(h3,p),.document-card-grid .item-card :is(h3,p){overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
/* Enlarged tab targets for editing resources and finance. */
.resource-tabs{gap:7px;padding-bottom:12px}
.resource-tabs .resource-tab{min-height:43px;padding:11px 17px;font-size:13px}
.finance-toolbar>label,.fieldwork-toolbar>label,.archive-toolbar>label{flex:0 0 100%;min-height:0!important;margin-bottom:-5px;font-size:12px}
.archive-toolbar .project-lookup-field{flex:1 1 260px;max-width:none}
.archive-toolbar #archiveInspect{margin-left:auto}
/* Date picker has only one path (no native Safari overlay). */
.date-lookup-field{align-items:stretch;max-width:none}
.date-lookup-field>input[type=date]{cursor:pointer;min-width:0}
.date-lookup-field>input[type=date]::-webkit-calendar-picker-indicator{opacity:0;display:none}
.date-lookup-launch{flex:0 0 44px!important;width:44px;min-width:44px!important;padding:7px!important;font-size:20px!important}
input[data-time-entry="24h"]{font-variant-numeric:tabular-nums;letter-spacing:.4px}
input[data-time-entry="24h"]::placeholder{opacity:.6}
/* Readable scheduling header, matching task and event cards. */
.production-week-toolbar{gap:14px}
.production-week-controls{display:flex;gap:0;align-items:center;flex-wrap:wrap;border:1px solid #47574b;border-radius:8px;overflow:hidden}
.production-week-controls button{margin:0;border-radius:0;border:0;border-right:1px solid #3b4a40;min-height:42px}
.production-week-controls button:last-child{border-right:0}
#productionWeekPick{min-width:140px;font-weight:700;color:#dff1e4}
.production-list .production-row{min-height:126px;display:flex;flex-direction:column;gap:8px}
.production-list .production-row .action-row{margin-top:auto}
/* Tablet/mobile: no horizontal clipping, aligned project navigation and filters. */
@media(max-width:1130px){
 .project-context-tabs{display:flex;overflow-x:auto;flex-wrap:nowrap;scroll-snap-type:x proximity;padding-bottom:6px}
 .project-context-tabs button{flex:0 0 108px;scroll-snap-align:start}
 .project-list-rows .project-row-compact{grid-template-columns:32px minmax(120px,1fr);row-gap:12px}
 .project-row-compact .stage-track{grid-column:2;grid-row:2}
 .project-search-toolbar,#ideasView>.toolbar{grid-template-columns:minmax(210px,1fr) repeat(2,minmax(130px,1fr))}
 .project-search-toolbar>select:last-child,#ideasView>.toolbar>select:last-child{grid-column:3}
}
@media(max-width:760px){
 .project-search-toolbar,#ideasView>.toolbar,#opportunitiesView>.toolbar,#documentsView>.toolbar,#resourcesView .resource-filter{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .project-search-toolbar .search-field,#ideasView>.toolbar .search-field,#opportunitiesView>.toolbar .search-field,#documentsView>.toolbar .search-field,#resourcesView .resource-filter .search-field{grid-column:1/-1;min-width:0}
 .project-search-toolbar>select,#ideasView>.toolbar>select,#opportunitiesView>.toolbar>select,#documentsView>.toolbar>select{grid-column:auto!important;width:100%}
 .project-list-rows .project-row-compact{grid-template-columns:32px minmax(0,1fr);padding:12px}
 .project-row-compact .stage-track{grid-column:1/-1;grid-row:auto}
 .project-row-compact h3{white-space:normal}
 .search-field{min-width:0;width:100%}
 .list-controls{align-items:flex-start}
 .project-context-stage .stage-track{overflow-x:auto;padding-bottom:8px}
 .project-context-stage .stage-node{min-width:54px}
 .production-week-controls{width:100%}
 .production-week-controls button{flex:1}
 body dialog .two{grid-template-columns:1fr}
}
@media(max-width:460px){
 .project-search-toolbar,#ideasView>.toolbar,#opportunitiesView>.toolbar,#documentsView>.toolbar,#resourcesView .resource-filter{grid-template-columns:1fr!important}
 .project-search-toolbar>select,#ideasView>.toolbar>select,#opportunitiesView>.toolbar>select,#documentsView>.toolbar>select{grid-column:1/-1!important}
 .search-action{min-width:66px!important}
 .list-controls .project-list-actions{width:100%;flex-wrap:wrap}
 .project-card-grid{grid-template-columns:1fr}
 .project-context-head strong{width:auto}
 .pager{gap:3px}.pager button{padding:6px 8px;min-width:30px}
}
/* Mobile sidebar is a horizontal menu, not a row of clipped vertical labels. */
@media(max-width:640px){
 .shell,.sidebar,.main,.content{min-width:0;max-width:100%}
 .sidebar{width:100%;overflow:hidden}
 .sidebar nav{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;max-width:100%;width:100%;gap:6px;-webkit-overflow-scrolling:touch;padding:0 0 5px}
 .sidebar .nav-item{flex:0 0 auto;min-width:max-content;width:auto;white-space:nowrap;word-break:keep-all;writing-mode:horizontal-tb;padding:10px 12px;min-height:40px}
 .sidebar .nav-item span{display:inline-block;white-space:nowrap}
 .topbar,.main{max-width:100%}
}
.pager button.page-number{border:1px solid #3e4c41;background:#252c27;color:#cbd8ce}
.pager button.page-number.current{background:#425f4c;color:#f5fff6;border-color:#9dbfa7}

/* Modal rhythm and consistent ISO date display, including Safari. */
body dialog .form-panel>label{display:block;margin:19px 0 8px}
body dialog .form-panel>input:not([type=hidden]){display:block;margin:0}
body dialog .form-panel>textarea{display:block;margin:0 0 22px;min-height:92px}
body dialog .form-panel>.two{margin:18px 0 20px;row-gap:16px}
body dialog .form-panel .two>div>label{display:block;line-height:1.45;margin:0 0 9px!important}
body dialog .form-panel .two>div>input,body dialog .form-panel .two>div>select{margin:0}
body dialog .form-panel>.dialog-title{margin-bottom:12px}
#ideaForm>textarea{margin-bottom:26px}
#ideaForm>.two{margin-top:16px}
#oppCreateForm>.two+div.two{margin-top:18px}
.date-lookup-field>input[data-date-lookup=yes]{font-variant-numeric:tabular-nums;cursor:pointer;letter-spacing:.3px}

/* Fieldwork and video review action rhythm: keep save buttons away from notes. */
.fieldwork-fields{gap:16px;margin:14px 0 18px}
.fieldwork-fields+.action-row{margin:18px 0 24px}
.fieldwork-shot-grid{gap:16px;margin:16px 0 21px}
.fieldwork-shot .field-control>span{margin-bottom:2px}
.review-create-dialog .review-create-grid{gap:18px;padding:27px 29px 30px;align-items:end}
.review-create-dialog .review-input-group label{display:block;margin:0 0 9px;line-height:1.5}
.review-create-dialog .review-create-grid>button{margin-top:7px}
@media(max-width:600px){.review-create-dialog .review-create-grid{padding:20px 16px}}
