/* UX-P19.1 R2 — isolated UI improvements. Existing rows/revisions remain intact. */
#opportunitiesView .opp-workspace-tabs{display:flex;gap:8px;border-bottom:1px solid #425048;margin:18px 0 21px}
#opportunitiesView .opp-workspace-tabs button{appearance:none;border:1px solid transparent;border-bottom:3px solid transparent;padding:11px 22px 12px;background:transparent;color:#aebbb2;font-size:14px;font-weight:650;min-height:44px;cursor:pointer;border-radius:8px 8px 0 0}
#opportunitiesView .opp-workspace-tabs button.active{color:#e5f3e9;border-bottom-color:#94b8a1;background:#27342c}
#opportunitiesView .opp-workspace-tabs button:focus-visible{outline:2px solid #b8dfcb;outline-offset:2px}
#opportunitiesView #oppBriefsPanel .section-heading{margin:8px 0 20px}
#opportunitiesView #oppCasesPanel[hidden],#opportunitiesView #oppBriefsPanel[hidden],#opportunitiesView #oppNew[hidden]{display:none!important}
#opportunitiesView #oppProjectScope{margin-bottom:16px}
/* Fixed geometry; only the center portion scrolls on desktop. */
dialog#oppDetailDialog.opportunity-workspace-dialog[open]{display:flex;flex-direction:column;width:min(1100px,calc(100vw - 32px));max-width:1100px;height:min(85dvh,860px);max-height:calc(100dvh - 20px);padding:0;overflow:hidden}
#oppDetailDialog .dialog-view-bar{flex:0 0 auto;position:relative;top:auto}
#oppDetailDialog #oppDetail{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 clamp(16px,3vw,38px) 42px}
#oppDetailDialog .opp-detail-sticky-heading{position:sticky;top:0;z-index:8;display:grid;gap:1px;min-height:70px;align-content:center;background:#202821;border-bottom:1px solid #36463a;padding:10px 0 7px}
#oppDetailDialog .opp-detail-sticky-heading h2{font-size:22px;margin:0;line-height:1.35}
#oppDetailDialog .opp-detail-sticky-heading .eyebrow{margin:0}
#oppDetailDialog .opp-detail-tabs{position:sticky;top:70px;z-index:7;background:#202821;border-bottom:1px solid #425248;gap:2px;margin:0 0 20px;padding:8px 0 0}
#oppDetailDialog .opp-detail-tabs button{flex:1 0 auto;min-height:40px;min-width:0;background:transparent;color:#b4c4b9;border:0;border-bottom:2px solid transparent;border-radius:5px 5px 0 0;padding:8px 10px;font-weight:600}
#oppDetailDialog .opp-detail-tabs button.active{background:#2a352d;border-bottom-color:#a5c9b0;color:#ebf6ed}
#oppDetailDialog .opp-detail-tabs button:focus-visible{outline:2px solid #c5dec9;outline-offset:-3px}
#oppDetailDialog .opp-brief-links{display:flex;flex-wrap:wrap;align-items:center;gap:12px}
#oppDetailDialog .opp-brief-links h3{width:100%;margin:0}
#oppDetailDialog .opp-brief-links .secondary{margin:0}
/* Document type chips: subtle surfaces with distinct hue, readable text stays visible. */
.document-kind-tag{display:inline-flex;align-items:center;font-weight:650!important;border:1px solid}
.document-kind-tag[data-kind=proposal]{background:#32483b;color:#d4efd7;border-color:#789b83}
.document-kind-tag[data-kind=shooting]{background:#33445c;color:#d7e4fc;border-color:#6b86ad}
.document-kind-tag[data-kind=run_of_show]{background:#524432;color:#f2ddbe;border-color:#aa8861}
.document-kind-tag[data-kind=cue_sheet]{background:#573b49;color:#f3d6e0;border-color:#a17891}
.document-kind-tag[data-kind=editing]{background:#2b4d50;color:#d4f1ec;border-color:#64979b}
.document-proposal-label-row{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:5px}
.document-proposal-label-row label{margin:0}
.document-proposal-label-row .document-copy-field{min-width:34px;min-height:32px;padding:4px 9px;font-size:18px}
.document-copy-all{white-space:nowrap}
/* Previous stages reached does not mean verified completed. */
.stage-node.stage-prior .stage-dot{background:#56685f;border-color:#8b9d92}
.stage-node.stage-prior:not(:last-of-type):after{background:#657b6a}
.stage-node.current .stage-dot{background:#a1d3bb;border-color:#e5fff0;box-shadow:0 0 0 4px rgba(117,192,151,.24);transform:scale(1.07)}
.stage-node.stage-complete .stage-dot{background:#bf766d;border-color:#edb6ae;box-shadow:0 0 0 4px rgba(191,118,109,.18)}
.stage-node.stage-complete .stage-name{color:#e8b6b1;font-weight:700}
/* PDF = browser Print > Save as PDF; no server rendering dependency. */
dialog.p191-handoff-dialog{width:min(1040px,calc(100vw - 30px));max-width:1040px;max-height:91dvh;overflow:auto;border-radius:10px}
.p191-handoff-toolbar{position:sticky;top:0;z-index:4;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 22px;background:#202920;border-bottom:1px solid #435044}
.p191-handoff-toolbar>div{display:flex;gap:8px;flex-wrap:wrap}
.p191-handoff-sheet{max-width:210mm;min-height:230mm;margin:14px auto;padding:18mm 17mm;color:#1e2421;background:#fff;font-size:12px;line-height:1.55;box-shadow:0 3px 18px #0005;overflow-wrap:anywhere}
.p191-paper-kicker{color:#4f6b5c;font-size:10px;letter-spacing:.13em;font-weight:700}
.p191-handoff-sheet h1{font-size:25px;color:#233b2f;margin:14px 0 6px}
.p191-handoff-sheet h2{font-size:17px;color:#24382b;margin:0 0 20px}
.p191-handoff-sheet h3{font-size:15px;color:#24382b;margin:0 0 10px}
.p191-handoff-sheet h4{font-size:13px;color:#2b3c32;margin:0 0 10px}
.p191-paper-meta{display:grid;grid-template-columns:130px minmax(0,1fr);gap:3px 10px;margin:10px 0}
.p191-paper-meta dt{color:#56665d;font-weight:600}
.p191-paper-meta dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.p191-paper-section{border-top:1px solid #c4d0c9;margin:18px 0 0;padding:15px 0 0;break-inside:avoid-page}
.p191-paper-section:has(.p191-paper-shot){break-inside:auto}
.p191-paper-pre{white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0}
.p191-paper-shot{padding:13px 0;border-bottom:1px solid #dbe2dc;break-inside:avoid-page}
.p191-paper-warning{border-left:3px solid #b67449;padding-left:12px}
@media(max-width:670px){
 #opportunitiesView .opp-workspace-tabs button{flex:1;padding:9px 12px}
 dialog#oppDetailDialog.opportunity-workspace-dialog[open]{width:98vw;height:93dvh;max-height:93dvh}
 #oppDetailDialog .opp-detail-tabs{overflow-x:auto;flex-wrap:nowrap;top:72px}
 #oppDetailDialog .opp-detail-tabs button{flex:0 0 auto;white-space:nowrap}
 .p191-handoff-sheet{padding:20px 14px;min-height:0}
 .p191-paper-meta{grid-template-columns:1fr}
 .p191-handoff-toolbar{flex-wrap:wrap}
}
@media print{
 body.printing-p191-handoff #shell,body.printing-p191-handoff #loginScreen,body.printing-p191-handoff #notice{display:none!important}
 body.printing-p191-handoff dialog:not(#p19HandoffPreviewDialog){display:none!important}
 body.printing-p191-handoff #p19HandoffPreviewDialog{display:block!important;position:static!important;max-height:none!important;height:auto!important;width:auto!important;max-width:none!important;border:0!important;padding:0!important;margin:0!important;overflow:visible!important;color:#000!important}
 body.printing-p191-handoff .p191-handoff-toolbar{display:none!important}
 body.printing-p191-handoff .p191-handoff-sheet{box-shadow:none!important;max-width:none;min-height:0;width:100%;padding:0!important;margin:0!important}
 @page{size:A4;margin:16mm 15mm}
}

/* R2: the workspace tab row stays pinned at the same right-hand position for either list. */
#opportunitiesView .opp-workspace-tab-row{display:flex;justify-content:flex-end;align-items:flex-end;border-bottom:1px solid #425048;margin:0 0 18px;min-height:50px}
#opportunitiesView .opp-workspace-tabs{width:max-content;margin:0;border:0;flex:0 0 auto;gap:6px}
#opportunitiesView .opp-workspace-tabs button{white-space:nowrap}
#opportunitiesView .opp-panel-actionbar{min-height:54px;margin:0 0 16px;gap:12px}
#opportunitiesView .opp-panel-actionbar h2{margin:0;font-size:17px}
#opportunitiesView .opp-panel-actionbar button{min-height:40px}
/* R2 Safari revision: tabs blend with the charcoal header; only the underline marks selection. */
#oppDetailDialog .opp-detail-tabs{display:flex;flex-wrap:nowrap;margin:0 calc(-1 * clamp(16px,3vw,38px)) 20px;padding:8px clamp(16px,3vw,38px) 0;background:#202821;border-bottom:1px solid #425248;gap:2px}
#oppDetailDialog .opp-detail-tabs button{flex:1 1 0;min-width:0;min-height:43px;padding:8px 5px;border-radius:4px 4px 0 0;line-height:1.25;font-size:12px;white-space:normal}
#oppDetailDialog .opp-detail-tabs button.active{background:transparent;color:#eef4f0;border-bottom-color:#a5c9b0}
#oppDetailDialog .opp-brief-links{column-gap:8px;row-gap:10px}
/* R2: editing documents are edited as scenes; horizontally scrolling tables remain for older templates. */
.document-editing-cards{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;min-width:0}
.editing-scene-card{border:1px solid #46574c;border-radius:8px;background:#212824;min-width:0;overflow:hidden}
.editing-scene-header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;padding:12px 15px;border-bottom:1px solid #39483e;background:#29352d}
.editing-scene-heading{font-size:13px;font-weight:700;color:#dce9dd;min-width:0;overflow-wrap:anywhere}
.editing-scene-controls{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end;flex-shrink:0}
.editing-scene-controls button{min-height:32px;padding:6px 9px;font-size:12px}
.editing-scene-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;padding:14px;min-width:0}
.document-editing-field{display:block;min-width:0}
.document-editing-field label{display:block;margin:0 0 5px;font-size:12px;color:#bdcdbf}
.document-editing-field textarea{width:100%;min-width:0;min-height:82px;resize:vertical}
.document-editing-field[data-editing-field="section"]{grid-column:1/-1}
.document-editing-field[data-editing-field="source"]{grid-column:1/-1}
.document-editing-field[data-editing-field="reference_ids"]{grid-column:1/-1}
.document-editing-field .document-row-references{width:auto;min-width:0}
.document-editing-field .reference-pills{max-width:none}
.document-editing-field .row-ref-select{max-width:min(100%,340px)}
.document-editing-field[hidden]{display:none!important}
.editing-column-choices{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:12px 14px;border:1px solid #455449;background:#232a24;border-radius:6px;margin:10px 0 18px}
.editing-column-choices strong{font-size:12px;color:#c9d7cc}
.editing-column-choices label{display:inline-flex;align-items:center;gap:5px;margin:0;padding:4px 2px;font-size:12px;cursor:pointer}
.editing-column-choices input{width:16px;height:16px;accent-color:#a4c4a9}
.editing-column-help{font-size:11px;line-height:1.65;color:#9daa9f;margin:0 0 12px}
@media(max-width:720px){
 #opportunitiesView .opp-workspace-tab-row{min-height:46px}
 #opportunitiesView .opp-workspace-tabs{width:100%;gap:2px}
 #opportunitiesView .opp-workspace-tabs button{flex:1 1 0;padding:10px 8px;min-width:0}
 #oppDetailDialog .opp-detail-tabs{flex-wrap:wrap;overflow:visible;top:72px;margin-left:-16px;margin-right:-16px;padding-left:16px;padding-right:16px}
 #oppDetailDialog .opp-detail-tabs button{flex:1 1 30%;white-space:normal}
 .editing-scene-grid{grid-template-columns:minmax(0,1fr)}
 .editing-scene-header{flex-wrap:wrap}
 .editing-scene-controls{justify-content:flex-start}
}

/* Safari R2 follow-up: scene cards for shooting, same data IDs and export schema. */
.document-shooting-cards{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;min-width:0}
.shooting-scene-card{border:1px solid #46574c;border-radius:8px;background:#212824;min-width:0;overflow:hidden;scroll-margin-top:135px}
.shooting-scene-header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;padding:12px 15px;border-bottom:1px solid #39483e;background:#29352d}
.shooting-scene-heading{font-size:13px;font-weight:700;color:#dce9dd;min-width:0;overflow-wrap:anywhere}
.shooting-scene-controls{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end;flex-shrink:0}
.shooting-scene-controls button{min-height:32px;padding:6px 9px;font-size:12px}
.shooting-scene-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;padding:14px;min-width:0}
.shooting-scene-field{display:block;min-width:0}
.shooting-scene-field label{display:block;margin:0 0 5px;font-size:12px;color:#bdcdbf}
.shooting-scene-field textarea{width:100%;min-width:0;min-height:82px;resize:vertical}
.shooting-scene-field[data-shooting-field="scene"],.shooting-scene-field[data-shooting-field="content"],.shooting-scene-field[data-shooting-field="reference_ids"]{grid-column:1/-1}
.shooting-scene-field .document-row-references{width:auto;min-width:0}
.shooting-scene-field .reference-pills{max-width:none}
.shooting-scene-field .row-ref-select{max-width:min(100%,340px)}
.editing-scene-card{scroll-margin-top:135px}
/* Compact scene remote: follows scrolling inside the document dialog, not the page. */
#documentDetailDialog .document-scene-nav{position:sticky;top:56px;z-index:4;display:flex;align-items:center;gap:7px 9px;flex-wrap:wrap;margin:14px 0 12px;padding:9px 12px;border:1px solid #49584d;background:#242e28;border-radius:8px;box-shadow:0 5px 16px #0005;max-width:100%;min-width:0}
.document-scene-nav strong{font-size:12px;white-space:nowrap;color:#dce9dd}
.document-scene-nav select{flex:1 1 180px;max-width:440px;min-width:110px;width:auto;margin:0;font-size:12px}
.document-scene-nav button{font-size:12px;padding:7px 9px;min-height:34px;white-space:nowrap;margin:0}
.document-scene-nav .document-scene-progress{font-size:12px;color:#bbcbbf;white-space:nowrap;font-variant-numeric:tabular-nums}
.document-scene-nav button:focus-visible,.document-scene-nav select:focus-visible{outline:2px solid #c5dec9;outline-offset:2px}
@media(max-width:720px){
 .shooting-scene-grid{grid-template-columns:minmax(0,1fr)}
 .shooting-scene-header{flex-wrap:wrap}
 .shooting-scene-controls{justify-content:flex-start}
 #documentDetailDialog .document-scene-nav{top:58px;gap:6px;padding:8px}
 .document-scene-nav strong{width:100%}
 .document-scene-nav select{min-width:120px;flex:1 1 140px}
}
@media print{.document-scene-nav{display:none!important}}


/* R2-fix2 Safari polish: make opportunity title/tabs one continuous charcoal band.
   The title previously stopped at the detail panel gutter, exposing a darker notch. */
#oppDetailDialog .opp-detail-sticky-heading{
  margin-inline:calc(-1 * clamp(16px,3vw,38px));
  padding-inline:clamp(16px,3vw,38px);
  background:#212923;
}
#oppDetailDialog .opp-detail-tabs{
  background:#212923;
}
#oppDetailDialog .opp-detail-tabs button{border-radius:0;}

/* R2-fix2 Safari polish: neutral, square-edged remote outside header overlap.
   The containing document dialog is itself the scroll viewport; reserve an
   explicit gap below the 54px sticky dialog header. */
#documentDetailDialog .document-scene-nav{
  top:90px;
  margin:12px 0 16px;
  padding:10px 12px;
  background:#181c20;
  border:1px solid #515b65;
  border-radius:0;
  box-shadow:none;
  color:#e3e6e9;
}
#documentDetailDialog .document-scene-nav strong{color:#e3e6e9;}
#documentDetailDialog .document-scene-nav select{background:#101316;border-color:#56616a;color:#e3e6e9;border-radius:0;}
#documentDetailDialog .document-scene-nav button{background:#25292e;border:1px solid #4b545e;color:#e3e6e9;border-radius:0;}
#documentDetailDialog .document-scene-nav button:hover:not(:disabled){background:#353b42;}
#documentDetailDialog .document-scene-nav .document-scene-progress{color:#c1c8ce;}
#documentDetailDialog .editing-scene-card,
#documentDetailDialog .shooting-scene-card{scroll-margin-top:195px;}
@media(max-width:720px){
  #documentDetailDialog .document-scene-nav{top:90px;padding:8px 10px;}
  #documentDetailDialog .editing-scene-card,
  #documentDetailDialog .shooting-scene-card{scroll-margin-top:250px;}
}

/* R2-fix3: consistent remote controls and a right-aligned add action. */
#documentDetailDialog .document-scene-nav button[data-nav-action="previous"],
#documentDetailDialog .document-scene-nav button[data-nav-action="next"],
#documentDetailDialog .document-scene-nav button[data-nav-action="top"]{
  flex:0 0 72px;
  width:72px;
  min-width:72px;
  min-height:36px;
  padding:7px 6px;
  text-align:center;
}
#documentDetailDialog .document-scene-nav button[data-nav-action="add"]{
  margin-left:auto;
  min-height:36px;
  padding:7px 11px;
  white-space:nowrap;
}
