/* PWG client workspace: a final, scoped palette contract.
 * Legacy dark-first workspace.css and the shared estate theme previously
 * mixed dark card backgrounds with light-mode dark text. Keep text/surface
 * pairs together, after both stylesheets, in both modes.
 * Color choices use the estate's semantic tokens; geometry stays in workspace.css.
 */

html[data-estate-theme="light"] body.workspace-body{
  background:var(--surface-canvas)!important;
  color:var(--text-primary)!important;
}

html[data-estate-theme="light"] body.workspace-body :is(.workspace-main,.workspace-view,.workspace-shell){
  color:var(--text-primary)!important;
}
html[data-estate-theme="light"] body.workspace-body :is(.workspace-topbar,.workspace-sidebar){
  background:var(--surface-panel)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme="light"] body.workspace-body :is(.workspace-brand,.workspace-context,.workspace-nav button){
  color:var(--text-secondary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-nav button.active{
  background:var(--surface-subtle)!important;
  color:var(--text-link)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .workspace-heading :is(h1,p),
html[data-estate-theme="light"] body.workspace-body .workspace-main :is(.card-head h3,.section-label,.workspace-kicker){
  color:var(--text-primary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main :is(.workspace-heading p,.view-intro,.signal-card small,.attention-card article p,.timeline-empty p){
  color:var(--text-secondary)!important;
}

/* Statistics: light cards use dark text. The featured card is intentionally
 * blue with white text, including its caption and value. */
html[data-estate-theme="light"] body.workspace-body .workspace-main .signal-card{
  background:var(--surface-panel)!important;
  border-color:var(--border-default)!important;
  color:var(--text-primary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .signal-card :is(span,strong,small,b){
  color:var(--text-primary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .signal-card>span,
html[data-estate-theme="light"] body.workspace-body .workspace-main .signal-card small{
  color:var(--text-secondary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .signal-card.primary{
  background:var(--control-primary)!important;
  border-color:var(--control-primary)!important;
  color:var(--control-primary-text)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .signal-card.primary :is(span,strong,small,b){
  color:var(--control-primary-text)!important;
}

/* Normal panels and empty states: remove the dark inverse island inside
 * a white client workspace. */
html[data-estate-theme="light"] body.workspace-body .workspace-main :is(
  .ledger-card,.trajectory-card,.attention-card,.brief-editor,.version-rail,
  .project-cards article,.document-list
){
  background:var(--surface-panel)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .ledger-table{
  background:var(--surface-panel)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main :is(
  .ledger-head h2,.card-head h3,.ledger-empty strong,.timeline-empty strong,
  .attention-card article strong,.attention-card .card-head h3
){
  color:var(--text-primary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .ledger-empty{
  background:var(--surface-subtle)!important;
  color:var(--text-primary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main :is(.ledger-empty p,.timeline-empty p,.attention-card article p){
  color:var(--text-secondary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .timeline-empty{
  background:var(--surface-subtle)!important;
  border-color:var(--border-default)!important;
  color:var(--text-primary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .ledger-row{
  background:var(--surface-panel)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .ledger-row :is(strong,small,span){
  color:var(--text-secondary)!important;
}
html[data-estate-theme="light"] body.workspace-body .workspace-main .ledger-row strong{
  color:var(--text-primary)!important;
}

/* Dark is a real dark appearance, not a light body pasted over dark cards.
 * In the dark mode all normal cards are raised dark surfaces with light text.
 * The featured signal stays accessible as a light-blue action-color surface. */
html[data-estate-theme="dark"] body.workspace-body .workspace-main .signal-card{
  background:var(--surface-panel)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .signal-card :is(span,strong,small,b){
  color:var(--text-primary)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .signal-card>span,
html[data-estate-theme="dark"] body.workspace-body .workspace-main .signal-card small{
  color:var(--text-secondary)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .signal-card.primary{
  background:var(--control-primary)!important;
  color:var(--control-primary-text)!important;
  border-color:var(--control-primary)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .signal-card.primary :is(span,strong,small,b){
  color:var(--control-primary-text)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main :is(
  .ledger-card,.trajectory-card,.attention-card,.brief-editor,.version-rail,
  .project-cards article,.document-list
){
  background:var(--surface-panel)!important;
  border-color:var(--border-default)!important;
  color:var(--text-primary)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main :is(
  .ledger-head h2,.card-head h3,.ledger-empty strong,.timeline-empty strong
){
  color:var(--text-primary)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .ledger-empty,
html[data-estate-theme="dark"] body.workspace-body .workspace-main .timeline-empty{
  background:var(--surface-subtle)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main :is(.ledger-empty p,.timeline-empty p){
  color:var(--text-secondary)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .ledger-row{
  background:var(--surface-panel)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .ledger-row :is(strong,small,span){
  color:var(--text-secondary)!important;
}
html[data-estate-theme="dark"] body.workspace-body .workspace-main .ledger-row strong{
  color:var(--text-primary)!important;
}

/* Private workspace recovery: scoped inverse surface pairing.
 * The global appearance contract loads later; specificity keeps recovery
 * headings and light engagement cards readable in either appearance mode. */
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card{
  background-color:var(--ws-bg)!important;
  color:var(--ws-text)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card :is(h1,.section-label){
  color:var(--ws-text)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card :is(
  [data-access-note],[data-recovery-note],[data-recovery-identity],.workspace-recovery-foot,
  .workspace-recovery-foot a,.workspace-recovery-form label
){
  color:var(--ws-muted)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item{
  color:var(--ws-bg)!important;
  background:var(--ws-text)!important;
  border:1px solid var(--border-strong)!important;
  min-height:106px;
  line-height:1.45;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item strong{
  color:var(--ws-bg)!important;
  font-size:16px;
  line-height:1.35;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item :is(span,small){
  color:var(--ws-panel2)!important;
  font-size:13px;
  line-height:1.5;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item:is(:hover,:focus-visible){
  background:var(--ws-text)!important;
  border-color:var(--ws-blue)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card .workspace-recovery-foot a{
  text-decoration:underline;
  text-underline-offset:3px;
}
@media(max-width:650px){
  html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card{
    padding:28px 20px;
  }
  html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item{
    min-height:100px;
  }
}

/* Saved solar engagement: retain readable source summaries and unambiguous
   client actions. Use only the canonical estate theme's paired color tokens. */
html[data-estate-theme] body.workspace-body .workspace-main .document-list a.strategy-document-link{
  background:var(--control-primary)!important;
  color:var(--control-primary-text)!important;
  border-color:var(--control-primary)!important;
  font-weight:700;
  text-decoration:none;
}
html[data-estate-theme] body.workspace-body .workspace-main .document-list a.strategy-document-link:is(:hover,:focus-visible){
  border-color:var(--focus-ring)!important;
  box-shadow:0 0 0 2px var(--focus-ring);
}
html[data-estate-theme] body.workspace-body :is(.workspace-context,.context-label,.save-state){
  color:var(--text-secondary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-main :is(
  .document-list small,.document-list article>b,.brief-editor label>span,
  .version-rail li small,.project-cards article>span
){
  color:var(--text-secondary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-main .brief-editor textarea[name="evidence"][hidden]{
  display:none!important;
}
html[data-estate-theme] body.workspace-body .workspace-main .discovery-source-summary{
  border:1px solid var(--border-default);
  background:var(--surface-subtle);
  color:var(--text-primary);
  border-radius:9px;
  padding:15px 18px;
  min-width:0;
}
html[data-estate-theme] body.workspace-body .workspace-main .discovery-source-summary dl{
  margin:0;
  display:grid;
  gap:10px;
}
html[data-estate-theme] body.workspace-body .workspace-main .discovery-source-summary dt{
  color:var(--text-secondary)!important;
  font-size:12px;
  font-weight:700;
}
html[data-estate-theme] body.workspace-body .workspace-main .discovery-source-summary dd{
  margin:0;
  color:var(--text-primary)!important;
  font-size:14px;
  line-height:1.5;
  overflow-wrap:anywhere;
}
html[data-estate-theme] body.workspace-body .workspace-main .discovery-source-summary p{
  color:var(--text-secondary)!important;
  border-top:1px solid var(--border-default);
  padding-top:12px;
  margin:15px 0 0;
  font-size:12px;
  line-height:1.55;
}

/* Client-facing consistency: light recovery uses the same light estate
   surfaces as the workspace. Dark recovery follows the dark estate tokens,
   rather than being an always-navy exception. */
html[data-estate-theme] body.workspace-body .workspace-access{
  background:var(--surface-canvas)!important;
  color:var(--text-primary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card{
  background:var(--surface-panel)!important;
  background-image:none!important;
  border:1px solid var(--border-default)!important;
  color:var(--text-primary)!important;
  box-shadow:0 14px 36px var(--border-default);
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card :is(h1,.section-label){
  color:var(--text-primary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card :is(
  p,[data-access-note],[data-recovery-note],[data-recovery-identity],
  .workspace-recovery-foot,.workspace-recovery-foot a,.workspace-recovery-form label
){
  color:var(--text-secondary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item{
  background:var(--surface-subtle)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item strong{
  color:var(--text-primary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item :is(small,span){
  color:var(--text-secondary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item:is(:focus-visible,:hover){
  background:var(--surface-raised)!important;
  border-color:var(--focus-ring)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-access-card .workspace-recovery-foot a{
  color:var(--text-link)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-row input{
  background:var(--surface-panel)!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
/* Version history: no ghosted headings or opacity inherited from dark-first
   samples. This is an active client record, not a disabled timeline. */
html[data-estate-theme] body.workspace-body .workspace-main .version-rail li{
  opacity:1!important;
  border-color:var(--border-default)!important;
}
html[data-estate-theme] body.workspace-body .workspace-main .version-rail li :is(strong,b),
html[data-estate-theme] body.workspace-body .workspace-main .lock-note strong{
  color:var(--text-primary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-main .version-rail li :is(small),
html[data-estate-theme] body.workspace-body .workspace-main .lock-note p{
  color:var(--text-secondary)!important;
}
html[data-estate-theme] body.workspace-body .workspace-main .version-rail li.current b{
  color:var(--text-link)!important;
}
/* Engagement document actions: same height, geometry and size. Filled means
   primary action, outlined means secondary action, not a disabled button. */
html[data-estate-theme] body.workspace-body .workspace-main .document-list :is(
  button[data-open-brief],a.strategy-document-link
){
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:180px;
  min-height:48px;
  padding:11px 16px;
  border-radius:10px!important;
  border:1px solid var(--border-default)!important;
  font:700 14px/1.25 Inter,ui-sans-serif,system-ui,sans-serif;
  text-decoration:none;
  white-space:normal;
  text-align:center;
  cursor:pointer;
}
html[data-estate-theme] body.workspace-body .workspace-main .document-list button[data-open-brief]{
  background:var(--surface-panel)!important;
  color:var(--text-link)!important;
}
html[data-estate-theme] body.workspace-body .workspace-main .document-list a.strategy-document-link{
  background:var(--control-primary)!important;
  color:var(--control-primary-text)!important;
  border-color:var(--control-primary)!important;
}
@media(max-width:650px){
  html[data-estate-theme] body.workspace-body .workspace-main .document-list article{
    grid-template-columns:25px minmax(0,1fr);
    row-gap:12px;
  }
  html[data-estate-theme] body.workspace-body .workspace-main .document-list :is(
    button[data-open-brief],a.strategy-document-link
  ){
    grid-column:2;
    width:min(100%,240px);
  }
}

/* Live Executive Attention empty state is generated by ::after, not an
   article paragraph. Explicitly pair it with the theme's actual panel surface
   so it remains legible in both light and dark client workspaces. */
html[data-estate-theme] body.workspace-body.live-workspace .workspace-main .attention-card::after{
  color:var(--text-secondary)!important;
  background:var(--surface-panel)!important;
  border-color:var(--border-default)!important;
  font-size:13px;
  line-height:1.55;
}

/* Verified-email recovery must show when a pilot still requires an active
   invitation, instead of presenting a clickable item that loops back. */
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item.requires-invitation{
  cursor:not-allowed!important;
  opacity:1!important;
  background:var(--surface-subtle)!important;
  border-color:var(--border-strong)!important;
}
html[data-estate-theme] body.workspace-body .workspace-access .workspace-recovery-item .recovery-invitation-required{
  display:block;
  margin-top:9px;
  color:var(--text-secondary)!important;
  font-size:13px;
  font-weight:600;
  line-height:1.5;
}
