/* SOGpt workbench refinement, 2026-09-26.
 * Load after component-hierarchy.css, agent-readability.css and card-light.css.
 * Fluent-inspired web styling; this is not native WinUI certification.
 * Scope excludes canvas nodes, scene geometry, dock layout and generated images.
 * Existing motion, status semantics, typography >= 14px and action order remain owned by their modules.
 */
:root {
  --fw-text: #eef1f6;
  --fw-secondary: #b3bcc0;
  --fw-muted: #a1adb3;
  --fw-line: #41494d;
  --fw-control-line: #718087;
  --fw-hover: #2d3438;
  --fw-pressed: #364149;
  --fw-focus: #9eddea;
  --fw-disabled: #7b868c;
  --fw-ok: #7cdaaa;
  --fw-warning: #e7c75d;
  --fw-dialog-shadow: 0 12px 32px rgb(0 0 0 / 30%), 0 1px 3px rgb(0 0 0 / 18%);
}
html[data-theme="light"] {
  --fw-text: #273436;
  --fw-secondary: #4d5d61;
  --fw-muted: #5d6b6f;
  --fw-line: #c6d0d1;
  --fw-control-line: #7c8b8f;
  --fw-hover: #e9eff0;
  --fw-pressed: #dce7e9;
  --fw-focus: #174b5c;
  --fw-disabled: #788589;
  --fw-ok: #246b4c;
  --fw-warning: #765819;
  --fw-dialog-shadow: 0 12px 32px rgb(23 64 78 / 14%), 0 1px 3px rgb(23 64 78 / 8%);
}

.sog-skip-link {
  position: fixed; z-index: 100000; inset-block-start: 12px; inset-inline-start: 16px;
  transform: translateY(-200%); padding: 10px 16px; border: 2px solid var(--fw-focus);
  border-radius: 4px; background: var(--surface-1); color: var(--fw-text);
  font: 600 14px/20px var(--font-ui); text-decoration: underline;
}
.sog-skip-link:focus { transform: none; outline: 2px solid var(--fw-focus); outline-offset: 2px; }
/* Programmatic skip target only; child controls keep their own focus indicator. */
#main-content:focus { outline: none !important; }

/* Shell: compact, readable labels; retain the established navigation structure. */
#app-shell .service-nav .nav { height: auto; min-height: 48px; padding-block: 6px; border-radius: 4px; }
#app-shell .service-nav .nav strong { font-size: 14px; line-height: 20px; }
#app-shell .service-nav .nav small { font-size: 12px; line-height: 16px; color: var(--fw-muted); }
#app-shell .service-nav .nav.active { background: var(--gold-soft); }
#app-shell .service-nav .nav:hover { background: var(--fw-hover); }
#app-shell .service-nav .nav:active { background: var(--fw-pressed); }
#app-shell :is(.sog-space-hint, .sog-project-copy > small) { font-size: 12px; line-height: 16px; color: var(--fw-muted); }
#pd-sidebar-context :is(#pd-context-projects, #kr-sidebar-projects) .sog-project-copy > small,
#project-tree .project-row > .sog-project-copy > small { font-size: 12px; line-height: 16px; color: var(--fw-muted); }
#app-shell .topbar :is(.agent-launch, .theme-toggle, .icon-button) {
  box-sizing: border-box; min-height: 32px; height: 32px; border-radius: 4px; font-size: 13px;
}
#app-shell .topbar :is(.theme-toggle, .icon-button) { min-width: 32px; }
/* The light-theme sidebar deliberately remains dark teal; it needs its own contrast context. */
html[data-theme="light"] #app-sidebar {
  --fw-muted: #c0d4da; --fw-secondary: #dde9ed;
  --fw-hover: #244f5e; --fw-pressed: #2b5b6b; --fw-focus: #b1e3ef;
}
html[data-theme="light"] #app-sidebar :is(.sog-space-hint, .brand small, .service-nav .nav small,
  .pd-nav-label, .pd-context-note, #pd-sidebar-context > button small, .project-section > header,
  .project-row > small, .project-row > span > i) { color: var(--fw-muted); }
html[data-theme="light"] #app-sidebar .service-nav .nav:is(.active, :hover, :active) { color: #fff; }
html[data-theme="light"] #app-sidebar .service-nav .nav.active { background: var(--fw-hover); }
html[data-theme="light"] #app-sidebar .service-nav .nav:active { background: var(--fw-pressed); }
html[data-theme="light"] #app-sidebar #pd-sidebar-context button[aria-current="page"] { background: var(--fw-hover); color: #fff; }
html[data-theme="light"] #app-sidebar #pd-rfp-entry strong { color: #fff; }
html[data-theme="light"] #app-sidebar #pd-rfp-entry > i { color: var(--fw-secondary); }
html[data-theme="light"] #app-sidebar #pd-rfp-entry:hover { background: var(--fw-hover); }
html[data-theme="light"] #app-sidebar #pd-rfp-entry:active { background: var(--fw-pressed); }
/* Match the legacy important sidebar-copy rule without affecting main-content project cards. */
html[data-theme="light"] #app-sidebar .sog-project-copy > small { color: var(--fw-muted) !important; }

/* Explicit actions only: no universal font reset and no canvas-node hit-box changes. */
:is(#view-library, #view-plugins, #view-requests, #view-agent, #project-desk, #pd-detail,
    #capability-dialog, #workflow-sop-dialog, #plugin-detail-dialog, #plugin-upload-dialog,
    #request-create-dialog, #request-detail-dialog, #task-detail-dialog, #review-upload-dialog,
    #review-detail-dialog, #director-studio-dialog, #structure-review-dialog, .kr-dialog)
  :is(.primary, .secondary, .plugin-upload-launch, .plugin-card-footer button,
      .capability-filter-toggle, .capability-filters button, .capability-card-actions button,
      .tracker-open-task, .request-submit, .tracker-board-actions > button, .request-board > header > button,
      .pd-action, .pd-text-action, .pd-project-toolbar button, .pd-section-heading button,
      .review-comment-link, .review-upload-item button, .ks-save button, .ks-intro > button,
      .ks-drop > button, .ks-mobile-entry, .ks-import-confirm button) {
  box-sizing: border-box; min-height: 32px; border-radius: 4px; font-size: 13px; line-height: 20px;
}
#view-library .capability-card-actions button { height: 32px; }
#view-library .capability-card .capability-save { width: 32px; min-width: 32px; }

/* Keyboard focus is independent of hover and survives high-contrast mode. */
:is(#app-sidebar, #app-shell .topbar, #view-library, #view-plugins, #view-requests,
    #view-agent, #view-project-work, #project-desk, #sog-agent-panel, #pd-detail, #capability-dialog, #workflow-sop-dialog,
    #plugin-detail-dialog, #plugin-upload-dialog, #request-create-dialog, #request-detail-dialog,
    #task-detail-dialog, #review-upload-dialog, #review-detail-dialog, #director-studio-dialog,
    #structure-review-dialog, .kr-dialog)
  :is(button, a[href], input:not([type="hidden"]), select, textarea, summary, [tabindex="0"]):focus-visible {
  /* Legacy styles.css sets outline !important; this equally scoped override makes the ring opaque. */
  outline: 2px solid var(--fw-focus) !important; outline-offset: 2px;
}
/* Image cards clip their contents; keep the focus perimeter inside the card. */
#view-library :is(.capability-card, .capability-section-card, .review-open):focus-visible {
  outline-offset: -3px;
}
:is(#view-library, #view-plugins, #view-requests, #view-agent, #project-desk, #pd-detail,
    #capability-dialog, #workflow-sop-dialog, #plugin-detail-dialog, #plugin-upload-dialog,
    #request-create-dialog, #request-detail-dialog, #task-detail-dialog, #review-upload-dialog,
    #review-detail-dialog, #director-studio-dialog, #structure-review-dialog, .kr-dialog)
  :is(button:disabled, button[aria-disabled="true"], input:disabled, select:disabled, textarea:disabled) {
  color: var(--fw-disabled); cursor: not-allowed; opacity: .72;
}
/* Quiet controls retain action-specific primary/danger colors. */
:is(#view-library, #view-plugins, #view-requests, #project-desk, #pd-detail,
    #capability-dialog, #plugin-detail-dialog, #plugin-upload-dialog, #request-create-dialog,
    #request-detail-dialog, #task-detail-dialog, #review-upload-dialog, #review-detail-dialog)
  :is(.secondary, .capability-filter-toggle, .capability-filters button, .plugin-filters button,
      .pd-action, .pd-project-toolbar button, .pd-section-heading button):not(:disabled):not([aria-disabled="true"]):hover {
  background: var(--fw-hover); border-color: var(--fw-control-line); color: var(--fw-text);
}
:is(#view-library, #view-plugins, #view-requests, #project-desk, #pd-detail,
    #capability-dialog, #plugin-detail-dialog, #plugin-upload-dialog, #request-create-dialog,
    #request-detail-dialog, #task-detail-dialog, #review-upload-dialog, #review-detail-dialog)
  :is(.secondary, .capability-filter-toggle, .capability-filters button, .plugin-filters button,
      .pd-action, .pd-project-toolbar button, .pd-section-heading button):not(:disabled):not([aria-disabled="true"]):active {
  background: var(--fw-pressed); color: var(--fw-text);
}

/* Gallery: retain the image-led masonry, improve actual search input and card actions. */
#view-library :is(.capability-heading > p:not(.eyebrow), .review-toolbar p) { font-size: 14px; line-height: 20px; color: var(--fw-secondary); }
#view-library :is(.capability-heading .eyebrow, .capability-governance span, .capability-tabs span,
  .capability-section-card small) { font-size: 12px; line-height: 16px; }
#view-library :is(.capability-heading .eyebrow, .capability-governance span, .capability-tabs span) { color: var(--fw-muted); }
#view-library .capability-tabs button { font-size: 13px; line-height: 20px; }
#view-library .capability-search {
  box-sizing: border-box; height: 32px; border-radius: 4px; border-color: var(--fw-control-line);
}
#view-library .capability-search input {
  box-sizing: border-box; height: 100%; min-height: 0; margin: 0; padding-block: 0;
  font-size: 14px; line-height: 20px; color: var(--fw-text);
}
#view-library .capability-search input::placeholder { color: var(--fw-muted); }
#view-library .capability-search:focus-within { border-color: var(--fw-focus); }
#view-library .capability-filter-toggle, #view-library .capability-filters button { height: 32px; }
#view-library :is(.capability-filter-toggle[aria-expanded="true"], .capability-filter-toggle.has-filter, .capability-filters button.active),
#view-plugins .plugin-filters button.active {
  background: var(--gold-soft); border-color: var(--gold); color: var(--fw-text); font-weight: 600;
}
#view-library :is(.capability-card-title, .capability-card-note) { font-size: 12px; line-height: 16px; }
#view-library .workflow-sop-card > p, #workflow-sop-dialog .workflow-sop-body > aside > p { font-size: 14px; line-height: 22px; color: var(--fw-secondary); }
#view-library :is(.workflow-sop-provider, .workflow-sop-lock, .workflow-sop-card > code,
  .workflow-sop-card dt, .workflow-sop-card dd, .workflow-sop-card footer),
#workflow-sop-dialog :is(.workflow-sop-sheet > header .eyebrow, .workflow-sop-sheet > header p:last-child,
  .workflow-sop-body aside dt, .workflow-sop-body aside dd),
#capability-dialog :is(.recipe-tags span, .recipe-facts span) { font-size: 12px; line-height: 18px; }
#capability-dialog .recipe-facts span { color: var(--fw-muted); }
#capability-dialog .recipe-facts strong { font-size: 14px; line-height: 20px; }

/* Script library and upload/detail forms share the same readable scale. */
#view-plugins .plugin-search { border-color: var(--fw-control-line); border-radius: 4px; background: var(--surface-2); }
#view-plugins .plugin-search input { height: 100%; font-size: 14px; color: var(--fw-text); }
#view-plugins .plugin-search input::placeholder { color: var(--fw-muted); }
#view-plugins .plugin-visual-label {
  padding: 6px 8px; border-radius: 4px; background: rgb(20 30 34 / 90%);
  color: #fff; font-size: 12px; line-height: 16px; font-weight: 600;
  letter-spacing: .03em; text-shadow: none;
}
#view-plugins .plugin-visual-label small {
  color: #e1e8eb; font-size: 12px; line-height: 16px; margin-top: 2px; text-shadow: none;
}
html[data-theme="light"] #sog-agent-panel .rag-context-table-wrap th {
  color: #5d6b6f; font-size: 12px; line-height: 18px;
}
#view-plugins .plugin-filters button { height: 32px; min-height: 32px; font-size: 13px; border-radius: 4px; }
#view-plugins .plugin-card { border-color: var(--fw-line); border-radius: 8px; background: var(--surface-1); }
#view-plugins .plugin-card-description { font-size: 14px; line-height: 22px; color: var(--fw-secondary); }
#view-plugins :is(.plugin-card-meta b, .plugin-card-meta span, .plugin-card-meta small, .plugin-owner) { font-size: 12px; line-height: 18px; }
#view-plugins :is(.plugin-card-meta span, .plugin-card-meta small, .plugin-owner) { color: var(--fw-muted); }
#view-plugins .plugin-card-meta b { height: auto; min-height: 21px; }
#plugin-detail-dialog :is(#plugin-detail-description, #plugin-detail-test-notes),
#plugin-upload-dialog :is(.plugin-upload-fields input:not([type="file"]):not([type="checkbox"]), .plugin-upload-fields textarea) { font-size: 14px; line-height: 22px; }
#plugin-detail-dialog :is(.plugin-detail-facts span, .plugin-detail-identity small),
#plugin-upload-dialog :is(.plugin-upload-fields label:not(.plugin-file-field):not(.plugin-confirm), header p:last-child, .plugin-upload-safety) { font-size: 12px; line-height: 18px; color: var(--fw-secondary); }
#plugin-detail-dialog .plugin-detail-facts strong { font-size: 14px; line-height: 20px; }
#plugin-detail-dialog .plugin-detail-shell > footer :is(button, a) { font-size: 13px; min-height: 36px; border-radius: 4px; }
#plugin-detail-dialog .plugin-detail-shell > footer .primary { color: var(--on-gold); }
#plugin-detail-dialog .plugin-detail-identity b { font-size: 12px; line-height: 18px; }
#plugin-detail-dialog .plugin-detail-identity b,
#plugin-upload-dialog .plugin-upload-safety i,
#view-library .workflow-sop-lock,
#workflow-sop-dialog .workflow-sop-sheet > header .eyebrow { color: var(--fw-ok); }
html[data-theme="light"] #view-plugins .plugin-card-meta b {
  background: #e7f3ec; color: var(--fw-ok);
}
html[data-theme="light"] #view-plugins .plugin-card.creator .plugin-card-meta b {
  background: #fff3d5; color: var(--fw-warning);
}

/* AI requests: maintain board density with readable copy and distinct statuses. */
#view-requests :is(.requests-hero p, .task-section-hero > div > p:last-child, .task-card-copy > p,
  .task-latest, .request-copy p, .request-card p) { font-size: 14px; line-height: 22px; color: var(--fw-secondary); }
#view-requests :is(.task-card-copy h3, .request-copy strong) { font-size: 14px; line-height: 20px; }
#view-requests :is(.tracker-column h3, .task-board > header h2, .activity-card > header h2,
  .request-board h2, .how-card li strong, .agent-managed strong) { font-size: 14px; line-height: 20px; }
#view-requests :is(.tracker-board-actions > span, .tracker-column > header > b,
  .agent-managed small, .daily-card .eyebrow, .how-card .eyebrow, .activity-card .eyebrow,
  .daily-card > footer, .how-card li > span, .how-card li small, #task-daily-report time) {
  font-size: 12px; line-height: 18px; color: var(--fw-muted);
}
#view-requests .tracker-column > header > b { height: auto; min-height: 20px; }
#view-requests :is(.task-id, .task-status, .task-progress-label, .task-card-meta, .task-latest > span,
  .task-metrics span, .task-owner-lock, .request-status, .request-meta, .request-meta b, .request-count,
  .tracker-request-link span, .tracker-request-link b, .tracker-request-link small,
  .task-request-link span, .task-request-link b, .task-request-link small,
  .tracker-column > header > p, .tracker-column > footer, .task-board > header p,
  .request-board header p, .tracker-column-empty) { font-size: 12px; line-height: 18px; }
#view-requests :is(.task-id, .task-progress-label, .task-card-meta, .request-meta, .request-count,
  .tracker-request-link span, .tracker-request-link small, .task-request-link span, .task-request-link small,
  .tracker-column > header > p, .tracker-column > footer, .request-board header p, .tracker-column-empty) { color: var(--fw-muted); }
#view-requests :is(.request-board, .daily-card, .how-card, .task-board, .task-daily-card, .activity-card, .ai-task-card) {
  border-color: var(--fw-line); border-radius: 8px; background: var(--surface-1);
}
#view-requests :is(#daily-report, #task-daily-report) { font-size: 14px; line-height: 22px; }
html[data-theme="light"] #view-requests :is(.request-status.resolved, .task-status.done) { color: var(--fw-ok); }
html[data-theme="light"] #view-requests .task-status.blocked { color: #a52b20; }
:is(#request-detail-dialog, #task-detail-dialog) :is(.request-description, .request-message-form textarea) { font-size: 14px; line-height: 22px; }
:is(#request-create-dialog, #request-detail-dialog, #task-detail-dialog)
  :is(.request-detail-meta > span:last-child, .request-attachment, .request-message-form label,
      .request-message-form > header > small, .request-message-form > footer > span, .attachment-actions > small) {
  font-size: 12px; line-height: 18px; color: var(--fw-secondary);
}
#request-create-dialog .request-create-form .attachment-actions label > span { font-size: 13px; min-height: 32px; box-sizing: border-box; }
#request-create-dialog .request-submit { background: var(--gold); color: var(--on-gold); }
#request-create-dialog .request-submit:not(:disabled):hover { background: var(--gold-hover); }

/* Agent: preserve the existing 16px conversation reading scale; fix home cards only. */
#view-agent :is(.agent-home-hero > p:not(.eyebrow), .agent-workflow-card p) { font-size: 14px; line-height: 22px; color: var(--fw-secondary); }
#view-agent :is(.agent-workflows > header p, .agent-workflows > header > span,
  .agent-workflow-card small, .agent-home-composer footer, .agent-home-hero > .eyebrow) { font-size: 12px; line-height: 18px; color: var(--fw-muted); }
#view-agent .agent-workflow-card { border-color: var(--fw-line); background: var(--surface-1); border-radius: 8px; }
#view-agent .agent-workflow-card h3 { font-size: 14px; line-height: 20px; color: var(--fw-text); }
#view-agent .agent-workflow-card:hover { background: var(--fw-hover); border-color: var(--fw-control-line); }
#view-agent .agent-workflow-card:active { background: var(--fw-pressed); }
#view-agent .agent-home-composer { border-color: var(--fw-control-line); border-radius: 8px; }
#view-agent .agent-home-composer textarea { font-size: 16px; line-height: 24px; }
#view-agent .agent-home-composer textarea::placeholder { color: var(--fw-muted); }
#view-agent .agent-home-composer footer button { min-height: 32px; font-size: 13px; border-radius: 4px; }
html:root #sog-agent-panel .agent-panel-tools button,
html:root #sog-agent-panel .agent-history-actions button { min-width: 32px; min-height: 32px; border-radius: 4px; }
html:root #sog-agent-panel .agent-history-list h4 { font-size: 12px; line-height: 18px; color: var(--fw-muted); }

/* Project Desk: strong project names with readable evidence and metadata. */
#project-desk { font-size: 14px; line-height: 22px; }
#project-desk :is(.pd-process-body p, .pd-baseline p, .pd-empty p, .pd-overview-footer p) { font-size: 14px; line-height: 22px; color: var(--fw-secondary); }
#project-desk :is(.eyebrow, .pd-privacy, .pd-muted, #pd-project-count, #pd-refreshed,
  .pd-process-body b, .pd-process-body small, .pd-project-row small, .pd-project-state small,
  .pd-overview-footer small, .pd-baseline small, .pd-badge, .pd-section-heading p,
  .pd-record-top time, .pd-record-meta, .pd-work-row small) { font-size: 12px; line-height: 18px; }
#project-desk :is(.pd-privacy, .pd-muted, #pd-project-count, #pd-refreshed, .pd-project-state small,
  .pd-baseline small, .pd-badge, .pd-section-heading p, .pd-record-top time, .pd-record-meta, .pd-work-row small) { color: var(--fw-muted); }
#project-desk :is(.pd-tabs button, .pd-project-toolbar select, .pd-process summary) { font-size: 13px; line-height: 20px; }
/* Undo the old icon-only summary rule, before and after split-actions decorates it. */
#project-desk #pd-process > summary > .split-action-label,
#project-desk #pd-process > summary > .split-action-label > span,
#project-desk #pd-process > summary:not(.split-action) > span {
  font-size: 13px !important; line-height: 20px; gap: 8px !important;
}
#project-desk .pd-search { border-color: var(--fw-control-line); border-radius: 4px; }
#project-desk .pd-search input { font-size: 14px; }
#pd-detail .pd-brief-facts { font-size: 14px; line-height: 22px; }
#project-desk :is(.pd-record, .pd-baseline, .pd-adopted-empty, .pd-process) { border-color: var(--fw-line); border-radius: 8px; }
#project-desk :is(.pd-project-row, .pd-work-row):active { background: var(--fw-pressed); }

/* Knowledge Studio and Review: repair hard-coded dark surfaces in light mode. */
.kr-shell {
  --kr-bg: var(--surface-1); --kr-panel: var(--surface-2); --kr-line: var(--fw-line);
  --kr-muted: var(--fw-muted); --kr-accent: var(--gold);
  color: var(--fw-text); font-family: var(--font-ui); font-size: 14px; line-height: 1.6;
  color-scheme: dark;
}
html[data-theme="light"] .kr-shell { color-scheme: light; }
.kr-dialog { background: var(--surface-1); color: var(--fw-text); border-color: var(--fw-line); }
.kr-dialog .kr-dialog-head { background: var(--surface-2); border-color: var(--fw-line); }
.kr-shell :is(.kr-panel, .kr-file-group) { background: var(--surface-2); border-color: var(--fw-line); border-radius: 8px; }
.kr-shell :is(.kr-inline, .kr-receipt, .kr-diff > div, blockquote, pre) { background: var(--surface-2); color: var(--fw-secondary); border-color: var(--fw-line); }
.kr-shell .kr-diff > div:last-child { background: var(--gold-soft); border-color: var(--gold); }
.kr-shell button { border-radius: 4px; font-size: 13px; line-height: 20px; background: var(--surface-3); color: var(--fw-text); }
.kr-shell button:not(:disabled):not([aria-disabled="true"]):hover { background: var(--fw-hover); border-color: var(--fw-control-line); }
.kr-shell button:not(:disabled):not([aria-disabled="true"]):active { background: var(--fw-pressed); }
.kr-shell button.kr-primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.kr-shell button.kr-primary:not(:disabled):hover { background: var(--gold-hover); border-color: var(--gold-hover); color: var(--on-gold); }
.kr-dialog .kr-tabs button { background: transparent; color: var(--fw-secondary); }
.kr-dialog .kr-tabs button.active { background: transparent; color: var(--fw-text); border-bottom-color: var(--gold); }
.kr-shell :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  box-sizing: border-box; border-color: var(--fw-control-line); background: var(--surface-1);
  color: var(--fw-text); border-radius: 4px; font-size: 14px; line-height: 22px;
}
.kr-shell :is(.kr-muted, .kr-eyebrow, .kr-badge, .kr-date small, .kr-status-steps, .kr-composer-tip, .kr-location) { font-size: 12px; line-height: 18px; }
.kr-shell :is(.kr-muted, .kr-date small, .kr-status-steps, .kr-location, .kr-empty, summary) { color: var(--fw-muted); }
.kr-shell .sog-project-copy > small { color: var(--fw-muted); }
.kr-shell :is(.kr-eyebrow, .kr-status-steps b) { color: var(--gold); }
.kr-shell .kr-date { color: var(--fw-text); }
.kr-shell .kr-badge { background: var(--gold-soft); border-color: var(--gold); color: var(--fw-text); }
html[data-theme="light"] .kr-shell :is(.kr-alert, .kr-badge.kr-warn) { background: #fff7df; border-color: #a0853b; color: #654d16; }
html[data-theme="light"] .kr-shell .kr-error { color: #a52b20; }
/* Review reading and pending cards contain their own legacy colors, beyond the outer panel. */
html[data-theme="light"] .kr-dialog :is(.kr-project-card, .kr-evidence-panel, .kr-draft-panel) {
  background: var(--surface-2); border-color: var(--fw-line); color: var(--fw-text);
}
html[data-theme="light"] .kr-dialog .kr-project-card-review,
html[data-theme="light"] .kr-dialog .kr-draft-panel { border-top-color: var(--gold); }
html[data-theme="light"] .kr-dialog :is(.kr-project-card h3, .kr-message header strong, .kr-review-layout h4),
html[data-theme="light"] .kr-dialog .kr-agent-reading .kr-summary-lead { color: var(--fw-text); }
html[data-theme="light"] .kr-dialog :is(.kr-card-summary, .kr-message > p, .kr-conversation-reading p,
  .kr-agent-reading, .kr-summary-focus p, .kr-review-layout .kr-message blockquote,
  .kr-message-context p, .kr-file-reading p) { color: var(--fw-secondary); }
html[data-theme="light"] .kr-dialog :is(.kr-message time, .kr-message-label,
  .kr-record-section h2 small, .kr-review-layout summary) { color: var(--fw-muted); }
html[data-theme="light"] .kr-dialog :is(.kr-message-label, .kr-project-card .kr-badge) { font-size: 12px; line-height: 18px; }
html[data-theme="light"] .kr-dialog :is(.kr-source-links a, .kr-source-jump a) { color: var(--gold); }
html[data-theme="light"] .kr-dialog :is(.kr-message, .kr-source-details, .kr-full-draft,
  .kr-more-options, .kr-other-records) { border-color: var(--fw-line); }
html[data-theme="light"] .kr-dialog .kr-review-layout .kr-message blockquote { border-left-color: var(--gold); }
html[data-theme="light"] .kr-dialog .kr-review-layout .kr-review-checks { background: #fff7df; border-color: #a0853b; }
html[data-theme="light"] .kr-dialog .kr-review-checks > summary,
html[data-theme="light"] .kr-dialog .kr-review-checks li { color: #654d16; }
html[data-theme="light"] #sog-agent-panel .kr-inline,
html[data-theme="light"] #sog-agent-panel .kr-inline :is(input:not([type="checkbox"]), textarea, select) {
  background: var(--surface-2); border-color: var(--fw-control-line); color: var(--fw-text);
}
html[data-theme="light"] #sog-agent-panel .kr-inline :is(blockquote, label > span, .kr-muted, summary),
html[data-theme="light"] #sog-agent-panel .kr-receipt strong { color: var(--fw-secondary); }
#director-studio-dialog :is(.ks-intro p, .ks-drop p, #ks-preview-body section p,
  #ks-import-preview section p, .ks-saved-content section p, .ks-saved-card > summary > p, .ks-empty p) {
  font-size: 14px; line-height: 22px; color: var(--fw-secondary);
}
#director-studio-dialog :is(.ks-drop small, .ks-fields small, .ks-consent, .ks-save span,
  .ks-preview > .eyebrow, .ks-kind, .ks-preview > small, .ks-saved-card small, .ks-open-label,
  .ks-feedback, .ks-error, h5, #ks-more summary span) { font-size: 12px; line-height: 18px; }
#director-studio-dialog :is(.ks-fields input:not([type="checkbox"]), .ks-fields select,
  .ks-fields textarea, .ks-filters input, .ks-filters select) { font-size: 14px; line-height: 22px; border-color: var(--fw-control-line); border-radius: 4px; }
#director-studio-dialog.ks-dialog .ks-consent { flex-direction: row; align-items: flex-start; }
/* Knowledge form hints are readable text, not disabled controls. */
#director-studio-dialog :is(.ks-fields input[placeholder], .ks-fields textarea[placeholder], .ks-filters input[placeholder])::placeholder,
.kr-dialog :is(input[placeholder], textarea[placeholder])::placeholder,
#sog-agent-panel .kr-inline :is(input[placeholder], textarea[placeholder])::placeholder {
  color: var(--fw-muted); opacity: 1;
}

/* Review / Compare: retain image geometry and drag behavior, expose clear controls. */
#view-library .review-card { border-color: var(--fw-line); border-radius: 8px; }
#view-library .review-card-body > p, #review-detail-dialog .review-discussion p { font-size: 14px; line-height: 22px; color: var(--fw-secondary); }
#review-detail-dialog .review-comment time { font-size: 12px; line-height: 18px; color: var(--fw-muted); }
:is(#review-upload-dialog, #review-detail-dialog) .review-form :is(input:not([type="checkbox"]), select, textarea),
#review-detail-dialog #review-comment { font-size: 14px; line-height: 22px; border-color: var(--fw-control-line); border-radius: 4px; }
#structure-review-dialog .sog-image-compare button { font-size: 13px; border-radius: 4px; }
#structure-review-dialog .sog-image-compare button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--fw-text); font-weight: 600; }
#structure-review-dialog .sog-image-compare button:not(:disabled):hover { border-color: var(--fw-control-line); }
#structure-review-dialog .sog-image-compare button:not(:disabled):active { background: var(--fw-pressed); }
#structure-review-dialog :is(.sog-compare-help, .sog-compare-share, .sog-compare-links) { font-size: 12px; line-height: 18px; color: var(--fw-secondary); }
#structure-review-dialog .sog-compare-stage:has(.sog-compare-slider:focus-visible) { outline: 2px solid var(--fw-focus); outline-offset: 3px; }

/* Overlays keep their original layout / max-height and gain a consistent outer edge. */
:is(#capability-dialog, #workflow-sop-dialog, #plugin-detail-dialog, #plugin-upload-dialog,
    #request-create-dialog, #request-detail-dialog, #task-detail-dialog, #pd-detail,
    #review-upload-dialog, #review-detail-dialog, #director-studio-dialog, #structure-review-dialog, .kr-dialog) {
  border-radius: 8px; border-color: var(--fw-line); box-shadow: var(--fw-dialog-shadow);
}
/* Preserve larger touch targets already supplied by the modules; prevent mobile input zoom. */
@media (max-width: 760px) {
  #view-library :is(.capability-filter-toggle, .capability-filters button, .capability-card-actions button),
  #view-plugins :is(.plugin-filters button, .plugin-card-footer button),
  #project-desk :is(.pd-action, .pd-text-action, .pd-project-toolbar button, .pd-section-heading button),
  #structure-review-dialog .sog-image-compare button { min-height: 44px; height: auto; }
  #view-library .capability-card .capability-save { min-width: 44px; }
  #view-library .capability-search { height: 44px; }
  #view-library .capability-search input, #view-plugins .plugin-search input,
  #project-desk .pd-search input { font-size: 16px; }
}
@media (forced-colors: active) {
  :root { --fw-focus: Highlight; --fw-control-line: ButtonText; --fw-line: GrayText; }
  #app-shell .service-nav .nav.active,
  #view-library .capability-filters button.active,
  #view-plugins .plugin-filters button.active,
  #structure-review-dialog .sog-image-compare button[aria-pressed="true"] { outline: 1px solid Highlight; outline-offset: -1px; }
  #structure-review-dialog .sog-compare-grip { border-color: ButtonText; }
}
