/* R8.11 Calm Blue UI. Presentation layer only; no workflow or security state changes.
 * Load after page styles. Tokens intentionally supersede legacy purple literals.
 */
:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --text: #182a3f;
  --muted: #52647a;
  --line: #d8e1eb;
  --primary: #1d4ed8;
  --primary-soft: #edf3ff;
  --accent: #1d4ed8;
  --success: #146c4e;
  --success-bg: #eaf6f0;
  --warning: #86500b;
  --warning-bg: #fff6e5;
  --danger: #b42318;
  --danger-bg: #fef0ee;
  --ui-navy: #16324f;
  --ui-rail: #102a43;
  --ui-rail-muted: #bfd0df;
  --ui-input-border: #7a8aa0;
  --ui-focus: #1d4ed8;
  --ui-radius-sm: 10px;
  --card-radius: 14px;
  --radius: 14px;
  --card-shadow: 0 2px 5px rgba(16,42,67,.035);
  --shadow: var(--card-shadow);
  --container-base: 1360px;
  --container-wide: 1360px;
  --gap-section: 28px;
  --pad-x: 32px;
  --ui-rail-width: 216px;
  --ui-bottom-nav: 76px;
}
html { scroll-padding-top: 28px; }
body.ui-theme { font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif; font-size: 15px; line-height: 1.65; overflow-x: visible; }
.ui-theme [hidden] { display: none !important; }
.ui-theme *, .ui-theme *::before, .ui-theme *::after { box-sizing: border-box; }
.ui-theme :where(h1,h2,h3,h4) { color: var(--ui-navy); letter-spacing: -.025em; line-height: 1.4; }
.ui-theme h1, .ui-theme .settings-hero h1, .ui-theme .automation-heading h1 { font-size: clamp(26px, 2.5vw, 34px); font-weight: 800; }
.ui-theme h2, .ui-theme .settings-section-heading h2 { font-size: 21px; }
.ui-theme h3 { font-size: 17px; }
.ui-theme p { line-height: 1.75; }
.ui-theme :where(small,.microcopy,time,.textarea-meta) { font-size: 13px; line-height: 1.6; }
.ui-theme :where(input,textarea,select,button) { font-family: inherit; }
.ui-theme .eyebrow { font-size: 11px; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.ui-theme .page { padding-top: 32px; }
.ui-theme .page-heading, .ui-theme .trend-hero { margin-bottom: 24px; }
.ui-page-description, .ui-theme .trend-subline, .ui-theme .automation-heading p:not(.eyebrow) { margin: 8px 0 0; font-size: 14px; color: var(--muted); max-width: 72ch; }
.ui-theme :where(.card,.slot,.automation-lite-card,.settings-card,.source-review) { box-shadow: var(--card-shadow); }
.ui-theme .card { border-color: var(--line); }
.ui-theme :where(.panel,.settings-section,.automation-panel,.automation-settings) { padding: 24px; }
.ui-theme :where(.section-heading,.settings-section-heading) { gap: 18px; }
.ui-theme :where(p,blockquote,dd,code,small,a,label,h1,h2,h3) { overflow-wrap: anywhere; }
.ui-theme :where(button,input,textarea,select,summary,a):focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
.ui-theme :where(input,textarea,select):focus { border-color: var(--primary); box-shadow: 0 0 0 3px #dbe7ff; }
.ui-theme :where(input,textarea,select) { border-color: var(--ui-input-border); border-radius: var(--ui-radius-sm); background: #fff; color: var(--text); font-size: 15px; }
.ui-theme :where(input,select) { min-height: 46px; }
.ui-theme textarea { resize: vertical; line-height: 1.8; }
.ui-theme :where(input,textarea)::placeholder { color: var(--muted); opacity: 1; }
.ui-theme input[type="checkbox"], .ui-theme input[type="radio"] { accent-color: var(--primary); width: 20px; height: 20px; min-height: 20px; flex-shrink: 0; padding: 0; }
.ui-theme :where(.check-row,.confirm-check,.automation-lite-toggle,.final-confirm-check) { color: var(--text); min-height: 48px; }
.ui-theme :where(.primary,.secondary,.candidate-action button,.trend-page .actions button,.compact) { min-height: 44px; border-radius: 10px; font-size: 14px; font-weight: 700; padding: 10px 16px; line-height: 1.5; }
.ui-theme .primary, .ui-theme .trend-page button.primary { background: var(--primary); border: 1px solid var(--primary); color: #fff; }
.ui-theme .primary:hover:not(:disabled) { background: #173fad; border-color: #173fad; }
.ui-theme .secondary, .ui-theme .candidate-action button, .ui-theme .trend-page .actions button:not(.primary) { background: #fff; border: 1px solid var(--ui-input-border); color: var(--ui-navy); }
.ui-theme :where(.secondary,.candidate-action button):hover:not(:disabled) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.ui-theme .text-button { color: var(--primary); min-height: 40px; font-size: 14px; }
.ui-theme .text-button.danger { color: var(--danger); }
.ui-theme button:disabled, .ui-theme button[aria-disabled="true"], .ui-theme .disabled { background: #e9eef4; color: #52647a; border-color: #c6d0dc; opacity: 1; cursor: not-allowed; box-shadow: none; }
.ui-theme .candidate.selected .candidate-action button:disabled { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.ui-theme :where(.text-link,.sources a,.source-pool a,.ui-secondary-link,.back-link) { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ui-theme .text-link { font-size: 14px; }
.ui-theme .back-link { min-height: 40px; display: inline-flex; align-items: center; }
.ui-theme .help-button { width: 26px; height: 26px; min-height: 26px; border-color: var(--ui-input-border); color: var(--muted); }
.ui-theme .help-button:hover, .ui-theme .help-button:focus-visible { background: var(--ui-navy); border-color: var(--ui-navy); color: #fff; }
.ui-theme .help-tooltip { background: var(--ui-navy); border-color: var(--ui-navy); }
.ui-theme summary { min-height: 44px; color: var(--ui-navy); font-size: 14px; line-height: 1.65; cursor: pointer; }
.ui-theme :where(.source-pool,.rejected-candidates,.queue-image-tool,.queue-ai-rewrite,.queue-editor,.scheduled-publish-form,.settings-details,.settings-advanced,.automation-advanced-shell,.automation-details,.image-request-details) { background: #fff; border-color: var(--line); border-radius: 12px; }
.ui-theme :where(.settings-details,.settings-advanced,.automation-advanced-shell,.automation-details)>summary { background: var(--surface-soft); color: var(--ui-navy); }
.ui-theme :where(.queue-ai-rewrite,.queue-image-tool)>summary { align-items: center; flex-direction: row; background: var(--surface-soft); }
.ui-theme :where(.queue-image-tool,.queue-ai-rewrite)>summary::after { content: '+'; font-size: 20px; color: var(--muted); margin-left: auto; }
.ui-theme :where(.queue-image-tool,.queue-ai-rewrite)[open]>summary::after { content: '−'; }
.ui-theme :where(.queue-image-tool,.queue-ai-rewrite)>summary small { color: var(--muted); font-size: 13px; }
.ui-theme :where(.badge,.chip,.count-pill,.slot-status,.status-chip,.source-state,.settings-state) { font-size: 12px; font-weight: 700; line-height: 1.5; padding: 5px 10px; }
.ui-theme :where(.chip.category,.candidate-kind,.status-drafted,.status-new,.status-queued,.status-pending,.status-processing,.status-approved,.processing-note,.image-reuse-tags span) { background: var(--primary-soft); color: var(--primary); }
.ui-theme :where(.badge.safe,.risk-safe,.status-published,.status-simulated,.slot-status.status-published,.status-chip.success,.compact-notice.safe,.settings-state.is-ready,.compliance-box.pass) { background: var(--success-bg); color: var(--success); }
.ui-theme :where(.risk-review,.status-held,.status-retry,.status-needs_review,.compact-notice.warning,.compliance-box.review,.source-state.warning) { background: var(--warning-bg); color: var(--warning); }
.ui-theme :where(.risk-block,.status-failed,.status-publish_failed,.status-blocked_billing,.status-chip.danger,.compliance-box.block,.inline-error,.slot-message.error) { color: var(--danger); background: var(--danger-bg); }
.ui-theme :where(.status-chip.neutral,.settings-state.is-off) { color: var(--muted); background: #edf1f5; }
.ui-theme :where(.notice,.compact-notice,.flash,.operator-strip) { border-radius: 12px; line-height: 1.7; font-size: 14px; }
.ui-theme .notice:not(.safe-notice):not(.warning-notice), .ui-theme .compact-notice:not(.safe):not(.warning) { color: var(--muted); background: var(--surface-soft); border-color: var(--line); }
.ui-theme .safe-notice { background: var(--success-bg); border-color: #b7dacc; color: var(--success); }
.ui-theme .safe-notice p { color: var(--success); }
.ui-theme .warning-notice { background: var(--warning-bg); border-color: #e5c795; }
.ui-theme .flash:not(.success):not(.error):not(.warning) { color: var(--primary); background: var(--primary-soft); }
.ui-theme .flash.success { color: var(--success); background: var(--success-bg); }
.ui-theme .flash.warning { color: var(--warning); background: var(--warning-bg); }
.ui-theme .flash.error { color: var(--danger); background: var(--danger-bg); }

/* Shared navigation: one consistent rail, responsive bottom navigation. */
.ui-nav-icon { width: 21px; height: 21px; flex: 0 0 21px; }
.ui-nav-caption { display: none; }
.skip-link { position: fixed; left: 12px; top: 8px; z-index: 100; padding: 12px 18px; background: #fff; color: var(--primary); border: 2px solid var(--primary); border-radius: 8px; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.ui-theme .brand-mark { background: var(--primary); border-radius: 12px; font-size: 22px; }
.ui-theme .brand-copy strong { font-size: 16px; }
.ui-theme .desktop-nav a { display: flex; align-items: center; gap: 11px; }
.ui-theme .brand-external { font-size: 16px; }
.ui-theme .topbar-actions .badge { white-space: nowrap; }
@media (min-width:1101px) {
  .ui-authenticated .app-header { position: fixed; width: var(--ui-rail-width); inset: 0 auto 0 0; background: var(--ui-rail); color: #fff; border: 0; backdrop-filter: none; overflow-y: auto; }
  .ui-authenticated .app-header-inner { width: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 32px 18px 24px; }
  .ui-authenticated .brand { gap: 9px; min-width: 0; padding: 0 2px 30px; flex-wrap: wrap; }
  .ui-authenticated .brand strong { color: #fff; }
  .ui-authenticated .brand-copy small { color: var(--ui-rail-muted); font-size: 11px; }
  .ui-authenticated .brand-mark { width: 38px; height: 38px; }
  .ui-authenticated .brand-external { display: none; }
  .ui-authenticated .ui-nav-caption { display: block; color: var(--ui-rail-muted); padding: 5px 12px 10px; font-size: 12px; letter-spacing: .04em; }
  .ui-authenticated .desktop-nav { display: flex; flex-direction: column; gap: 7px; align-items: stretch; justify-content: flex-start; }
  .ui-authenticated .desktop-nav a { color: #d6e2ef; padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; min-height: 48px; }
  .ui-authenticated .desktop-nav a.active { color: #fff; background: var(--primary); font-weight: 800; }
  .ui-authenticated .desktop-nav a:hover:not(.active) { color: #fff; background: #24435f; }
  .ui-authenticated .desktop-nav a:focus-visible { outline-color: #fff; }
  .ui-authenticated .topbar-actions { margin-top: auto; padding: 32px 6px 0; flex-wrap: wrap; justify-content: space-between; gap: 12px; min-width: 0; }
  .ui-authenticated .topbar-actions .text-button { color: #d6e2ef; font-size: 13px; }
  .ui-authenticated .topbar-actions .text-button:hover { color: #fff; }
  .ui-authenticated .page { width: min(calc(100% - var(--ui-rail-width)), var(--container-wide)); margin-left: calc(var(--ui-rail-width) + max(0px, (100% - var(--ui-rail-width) - var(--container-wide)) / 2)); margin-right: 0; padding-bottom: 64px; }
  .ui-authenticated .mobile-nav { display: none; }
  .ui-authenticated .settings-jumpbar { top: 12px; }
  .ui-authenticated .settings-save-dock { left: calc(var(--ui-rail-width) + 32px); width: auto; max-width: none; right: 32px; transform: none; }
}
@media (max-width:1100px) {
  .ui-theme .app-header { position: sticky; top: 0; background: #fff; backdrop-filter: none; }
  .ui-theme .app-header-inner { grid-template-columns: minmax(0,1fr) auto; width: 100%; min-height: 66px; padding-inline: 20px; gap: 8px; }
  .ui-theme .desktop-nav { display: none; }
  .ui-theme .brand-copy small,.ui-theme .brand-external { display: none; }
  .ui-theme .topbar-actions { gap: 8px; min-width: 0; }
  .ui-theme .topbar-actions .text-button { display: inline-flex; align-items: center; font-size: 13px; }
  .ui-theme .topbar-actions .badge { display: none; }
  .ui-authenticated .page { margin-inline: auto; padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  .ui-theme .mobile-nav { position: fixed; inset: auto 0 0; z-index: 30; display: flex; justify-content: flex-start; align-items: stretch; gap: 4px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); backdrop-filter: none; overflow-x: auto; }
  .ui-theme .mobile-nav a { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; min-height: 54px; flex: 0 0 70px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 5px 2px; }
  .ui-theme .mobile-nav a span { font-size: 11px; line-height: 1.3; }
  .ui-theme .mobile-nav a.active { color: var(--primary); background: var(--primary-soft); border-radius: 10px; }
  .ui-theme .mobile-nav.has-more { overflow: visible; }
  .ui-theme .mobile-nav.has-more > a,.ui-theme .mobile-nav.has-more > .ui-more-button { flex: 1 1 0; min-width: 0; }
  .ui-theme .settings-jumpbar { top: 76px; }
  .ui-theme :where(.settings-save-dock,.settings-sticky-save,.button-grid) { bottom: calc(var(--ui-bottom-nav) + env(safe-area-inset-bottom)); }
}
.ui-more-button { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); gap: 4px; font-size: 11px; font-weight: 700; border-radius: 10px; }
.ui-more-button svg { width: 21px; height: 21px; }
.ui-more-button.is-active { background: var(--primary-soft); color: var(--primary); }
.ui-more-dialog { border: 1px solid var(--line); border-radius: 20px 20px 0 0; background: #fff; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); width: 100%; max-width: 640px; max-height: min(80dvh,600px); margin: auto auto 0; color: var(--text); }
.ui-more-dialog::backdrop { background: rgba(16,42,67,.42); }
.ui-more-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ui-more-dialog h2 { margin: 0; font-size: 20px; }
.ui-more-close { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 1px solid var(--ui-input-border); border-radius: 10px; background: #fff; color: var(--text); font-size: 22px; }
.ui-more-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ui-theme .mobile-nav .ui-more-links a { min-height: 74px; display: flex; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; }
.ui-theme .mobile-nav .ui-more-links a span { font-size: 15px; }

/* Metrics and candidate selection: two readable columns rather than narrow triples. */
.ui-theme :where(.metric-grid,.overview) { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.ui-theme :where(.metric-card,.stat,.automation-metrics .metric-card) { padding: 20px; gap: 8px; }
.ui-theme :where(.metric-card strong,.stat>b,.automation-metrics .metric-card strong) { color: var(--ui-navy); font-size: 30px; line-height: 1.25; font-weight: 750; }
.ui-theme .metric-card.warning strong { color: var(--warning); }
.ui-theme .stat.tone-success>b { color: var(--success); }
.ui-theme .stat.tone-danger>b { color: var(--danger); }
.ui-theme :where(.metric-card span,.stat-label) { color: var(--muted); font-size: 13px; font-weight: 600; }
.ui-theme :where(.metric-card small,.stat small) { color: var(--muted); font-size: 12px; }
.ui-theme .operator-strip { padding: 16px 20px; margin: 0 0 22px; background: #fff; }
.ui-theme .operator-strip span { color: var(--muted); font-size: 13px; line-height: 1.8; }
.ui-workflow { display: flex; align-items: center; gap: 20px; margin: 0 0 22px; padding: 4px 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.ui-workflow span { display: flex; align-items: center; gap: 8px; }
.ui-workflow span+span::before { content: '›'; color: var(--muted); margin-right: 8px; font-size: 18px; font-weight: 400; }
.ui-workflow b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--primary); background: #e3ecfc; font-size: 12px; }
.ui-theme .slot { padding: 24px; }
.ui-theme .slot-head { margin-bottom: 18px; }
.ui-theme .slot-time { font-size: 12px; color: var(--muted); }
.ui-theme .candidates { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin: 22px 0; align-items: stretch; }
.ui-theme .candidate { display: flex; flex-direction: column; gap: 12px; padding: 22px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.ui-theme .candidate.selected { outline: none; border: 2px solid var(--primary); padding: 21px; background: #f8faff; }
.ui-theme .candidate.invalid { background: #fffafa; opacity: 1; border-color: #dfb5ad; }
.ui-theme .candidate header { flex-direction: column; align-items: flex-start; gap: 9px; }
.ui-theme .candidate header b { font-size: 17px; line-height: 1.65; font-weight: 750; color: var(--ui-navy); }
.ui-theme .candidate header span { display: inline-flex; color: var(--muted); background: var(--surface-soft); padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.ui-theme .candidate.invalid header span { color: var(--danger); background: var(--danger-bg); }
.ui-theme .candidate p { font-size: 14px; color: var(--muted); line-height: 1.85; }
.ui-theme .candidate-kind { align-self: flex-start; color: var(--primary); background: var(--primary-soft); padding: 4px 9px; border-radius: 6px; font-size: 12px; }
.ui-candidate-preview { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.ui-candidate-preview>summary { padding: 11px 14px; font-size: 13px; font-weight: 650; }
.ui-theme .candidate blockquote { margin: 0; padding: 16px; color: var(--text); background: #fff; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; font-size: 14px; line-height: 1.85; }
.ui-theme .candidate-preview-note { padding: 12px 14px; margin: 0; color: var(--muted); font-size: 12px; }
.ui-theme .candidate-image-empty { color: var(--muted); font-size: 12px; }
.ui-theme .sources { font-size: 12px; line-height: 1.8; gap: 6px; }
.ui-theme .candidate-action { margin-top: auto; padding-top: 8px; }
.ui-theme .candidate-action button { width: 100%; }
.ui-theme .source-pool { padding: 10px 14px; background: var(--surface-soft); }
.ui-theme .source-pool>summary,.ui-theme .rejected-candidates>summary { color: var(--muted); }
.ui-theme .source-pool :where(li,li small) { color: var(--muted); font-size: 13px; }
.ui-theme .research-summary { background: var(--primary-soft); color: var(--muted); font-size: 13px; }

/* Compose left / final confirmation right. Controls keep their original form scopes. */
.ui-theme .source-review { padding: 24px; margin: 16px 0 24px; border: 1px solid #a8bfec; border-top: 3px solid var(--primary); border-radius: 14px; background: #fff; scroll-margin-top: 24px; }
.ui-review-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ui-selected-title { margin: 10px 0 24px; color: var(--muted); font-size: 14px; }
.ui-review-grid { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 24px; align-items: start; }
.ui-compose-column { min-width: 0; display: grid; gap: 24px; }
.ui-compose-step>h3,.ui-publish-column>h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 16px; }
.ui-compose-step>h3 small { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12px; }
.ui-step-number { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; }
.ui-theme .source-review textarea[name="draft_text"] { min-height: 220px; background: #fff; font-size: 16px; }
.ui-theme .source-review .queue-image-tool { margin: 0; }
.ui-theme .source-review .queue-image-body { padding: 16px; }
.ui-publish-column { position: sticky; top: 24px; border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--surface-soft); min-width: 0; }
.ui-publish-facts { margin: 0 0 18px; }
.ui-publish-facts>div { padding: 10px 0; display: grid; gap: 4px; border-bottom: 1px solid var(--line); }
.ui-publish-facts dt { font-size: 12px; color: var(--muted); }
.ui-publish-facts dd { font-size: 14px; font-weight: 700; color: var(--ui-navy); }
.ui-theme .ui-publish-column .compact-notice { font-size: 13px; padding: 12px; margin: 12px 0; }
.ui-theme .source-review .confirm-check { padding: 12px; border: 1px solid var(--ui-input-border); border-radius: 10px; background: #fff; font-size: 13px; line-height: 1.8; }
.ui-theme .source-review .confirm-check input { margin-top: 2px; width: 20px; }
.ui-theme .ui-publish-column button[type="submit"] { width: 100%; }
.ui-theme .source-review .source-schedule { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 6px; }
.ui-theme .source-schedule>summary { padding: 10px 0; }
.ui-theme .source-schedule form { margin-top: 12px; }
.ui-theme .source-schedule label { font-size: 13px; }
.ui-theme .source-schedule p,.ui-theme .source-schedule small { color: var(--muted); font-size: 12px; }
.ui-theme .source-schedule input { margin-top: 7px; width: 100%; min-width: 0; }
.ui-secondary-link { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; min-height: 40px; margin-top: 10px; }
.ui-theme .source-final-copy { margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface-soft); }
.ui-theme .image-prompt-box { border-color: var(--line); padding: 0; background: #fff; }
.ui-theme .image-prompt-box>summary { padding: 12px 14px; }
.ui-theme .image-prompt-box>div,.ui-theme .image-prompt-box>p { margin: 12px 14px; }
.ui-theme .image-prompt-box>textarea { margin: 0 14px; width: calc(100% - 28px); font-size: 13px; }
.ui-theme .image-prompt-box>div:first-of-type { flex-direction: column; font-size: 13px; }
.ui-theme .image-prompt-box :where(p,span) { color: var(--muted); font-size: 13px; }
.ui-theme .image-request-details pre { background: var(--surface-soft); color: var(--text); }
.ui-image-status-note { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.ui-image-status-note strong { display: block; font-weight: 600; }
.ui-theme .image-plan-summary>div { border-color: var(--line); }
.ui-theme .image-plan-summary span { color: var(--muted); }
.ui-theme .image-plan-summary strong { color: var(--text); }
.ui-theme .image-plan-reason { color: var(--muted); border-left-color: var(--primary); background: var(--surface-soft); }
.ui-theme .image-input-grid .queue-tool-form { border-color: var(--line); padding: 16px; }
.ui-theme .queue-tool-form input,.ui-theme .queue-tool-form select,.ui-theme .image-approval-form input { border-color: var(--ui-input-border); border-radius: 10px; }
.ui-theme .source-review .image-input-grid { grid-template-columns: 1fr; gap: 14px; }
.ui-theme .attached-image { grid-template-columns: minmax(100px,180px) minmax(0,1fr); }
.ui-theme .attached-image img,.ui-theme .published-image-preview img { object-fit: contain; border-color: var(--line); background: var(--surface-soft); }
.ui-theme .source-review .attached-image img { width: 100%; }

/* Other pages share surfaces, spacing and semantic color instead of section rainbows. */
.ui-quick-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 0 0 24px; }
.ui-quick-actions a { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ui-quick-actions a:hover { border-color: var(--primary); background: #f8faff; }
.ui-quick-actions strong { color: var(--ui-navy); font-size: 16px; }
.ui-quick-actions span { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.ui-quick-actions b { color: var(--primary); }
.ui-theme .reply-card { padding: 22px; }
.ui-theme .reply-card:hover { transform: none; border-color: #91ace1; }
.ui-theme .reply-card-top strong { font-size: 15px; }
.ui-theme :where(.draft-preview,.queued-reply,.automation-copy-preview,.history-card,.diff-block) { background: var(--surface-soft); color: var(--text); }
.ui-theme .draft-preview { font-size: 14px; line-height: 1.8; border-left: 3px solid #91ace1; }
.ui-theme .draft-preview span { font-size: 11px; color: var(--muted); }
.ui-theme .filter-chip { font-size: 13px; border-radius: 10px; min-height: 44px; }
.ui-theme .filter-chip.active { background: var(--ui-navy); color: #fff; border-color: var(--ui-navy); }
.ui-theme .publish-tabs { gap: 10px; }
.ui-theme .publish-tabs a { min-height: 50px; border-radius: 10px; color: var(--muted); background: #fff; border-color: var(--line); }
.ui-theme .publish-tabs a.active { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.ui-theme :where(.final-publish-panel,.reservation-policy-box,.queue-editor,.queue-ai-rewrite,.queue-image-tool) { border-color: var(--line); background: var(--surface-soft); }
.ui-theme .final-publish-panel { border-top: 3px solid var(--primary); }
.ui-theme .schedule-review-grid span,.ui-theme .schedule-primary-summary span { color: var(--muted); font-size: 12px; }
.ui-theme .schedule-primary-summary strong { color: var(--ui-navy); }
.ui-theme .has-unsaved-changes .final-publish-panel,.ui-theme .has-unsaved-changes .scheduled-publish-form { opacity: 1; }
.ui-theme .settings-hero { padding: 0 0 24px; background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
.ui-theme .settings-hero::after { display: none; }
.ui-theme .settings-hero p:not(.eyebrow) { font-size: 14px; }
.ui-theme .settings-jumpbar { border-color: var(--line); box-shadow: var(--shadow); background: #fff; backdrop-filter: none; padding: 8px; }
.ui-theme .settings-jumpbar a { font-size: 13px; padding: 10px 14px; min-height: 44px; }
.ui-theme .settings-jumpbar a:hover,.ui-theme .settings-jumpbar a.is-active { background: var(--primary-soft); color: var(--primary); transform: none; }
.ui-theme .settings-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.ui-theme .settings-summary-card { padding: 18px; }
.ui-theme .settings-summary-card strong { color: var(--ui-navy); }
.ui-theme .settings-summary-card :where(span,small) { color: var(--muted); }
.ui-theme .settings-summary-card small { font-size: 12px; }
.ui-theme .settings-card-icon[class],.ui-theme .settings-section-number { border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.ui-theme .settings-section[class*="is-"] { border-color: var(--line); background: #fff; }
.ui-theme .settings-section.is-red { border-color: var(--line); }
.ui-theme .settings-card { border-color: var(--line); background: #fff; padding: 20px; }
.ui-theme :where(.settings-info-list dt,.settings-info-list dd,.settings-tip,.settings-privacy-note,.settings-empty-note,.settings-details-action,.settings-card-header p) { font-size: 13px; color: var(--muted); }
.ui-theme .settings-info-list dd { color: var(--text); }
.ui-theme .settings-card-title h3 { color: var(--ui-navy); }
.ui-theme .settings-state.is-ready>span { background: var(--success); }
.ui-theme :where(.settings-tip,.settings-privacy-note,.settings-empty-note,.settings-maintenance) { background: var(--surface-soft); border-color: var(--line); }
.ui-theme .settings-save-dock { border-color: var(--line); background: #fff; box-shadow: 0 -4px 16px rgba(16,42,67,.08); }
.ui-theme .settings-sticky-save { background: #fff; }
.ui-theme .switch-row { background: var(--surface-soft); }
.ui-theme .switch-control { min-height: 44px; align-items: center; }
.ui-theme .switch-control input:checked+i { background: var(--primary); }
.ui-theme .switch-control input:focus-visible+i { outline: 3px solid var(--primary); outline-offset: 3px; }
.ui-theme .field-item,.ui-theme .switch-copy small { color: var(--muted); font-size: 13px; }
.ui-theme .automation-lite-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.ui-theme .automation-lite-source { grid-column: 1 / -1; }
.ui-theme .automation-lite-card { padding: 24px; border: 1px solid var(--line); background: #fff; }
.ui-theme .automation-lite-card header { gap: 12px; margin-bottom: 20px; }
.ui-theme .automation-lite-step { background: var(--primary-soft); color: var(--primary); border-radius: 10px; }
.ui-theme .automation-lite-card h2 { font-size: 20px; }
.ui-theme .automation-lite-card p,.ui-theme .automation-lite-field small,.ui-theme .automation-lite-toggle small { color: var(--muted); font-size: 13px; line-height: 1.8; }
.ui-theme .automation-lite-field>span { color: var(--text); font-size: 14px; }
.ui-theme .automation-lite-toggle { background: var(--surface-soft); border-color: var(--line); padding: 14px; }
.ui-theme .automation-lite-toggle strong { color: var(--text); font-size: 14px; }
.ui-theme .automation-lite-toggle:has(input:checked) { background: var(--primary-soft); border-color: #9eb7e8; }
.ui-theme .automation-lite-charge { background: var(--surface-soft); border-color: var(--line); color: var(--muted); font-size: 13px; }
.ui-theme .automation-zone:not(.zone-emergency) { background: #fff; border-color: var(--line); }
.ui-theme .zone-number { color: var(--primary); background: var(--primary-soft); }
.ui-theme .automation-danger { background: var(--danger-bg); color: var(--danger); border-color: #dfb5ad; }
.ui-theme .automation-danger button { border-color: var(--danger); background: #fff; color: var(--danger); }
.ui-theme .automation-zone.zone-emergency { background: var(--danger-bg); border-color: #dfb5ad; }
.ui-theme .automation-field :where(input,select) { border-color: var(--ui-input-border); }
.ui-theme .automation-field small { color: var(--muted); font-size: 13px; }
.ui-theme .automation-section-head p:not(.eyebrow) { font-size: 13px; color: var(--muted); }
.ui-theme .automation-revision { background: var(--surface-soft); border-color: var(--line); }
.ui-theme .automation-revision :where(p,small,strong) { color: var(--text); }
.ui-theme .automation-help { color: var(--muted); }
.ui-theme .analytics-card { padding: 24px; border-color: var(--line); }
.ui-theme :where(.analytics-card,.strategy-card,.diagnosis-card,.ai-review,.ai-review-grid article,.ai-experiments article) { background: #fff; color: var(--text); }
.ui-theme :where(.analytics-help,.analytics-method,.ai-review-grid ul,.ai-experiments span,.ai-experiments small) { color: var(--muted); font-size: 13px; }
.ui-theme .mix-bar span:nth-child(1) { background: #1d4ed8; color: #fff; }
.ui-theme .mix-bar span:nth-child(2) { background: #146c4e; color: #fff; }
.ui-theme .mix-bar span:nth-child(3) { background: #52647a; color: #fff; }
.ui-theme :where(table th,table td) { font-size: 13px; padding: 13px 14px; color: var(--text); }
.ui-theme table th { background: var(--surface-soft); color: var(--muted); font-weight: 700; }
.ui-theme .login-page { padding: 32px 20px; min-height: 100dvh; }
.ui-theme .login-card { padding: 34px; border-top: 4px solid var(--primary); border-radius: 16px; width: min(440px,100%); }
.ui-theme .login-logo { background: var(--ui-navy); }

@media (max-width:1280px) and (min-width:1101px) {
  :root { --ui-rail-width: 200px; --pad-x: 26px; }
  .ui-review-grid { grid-template-columns: minmax(0,1fr) 280px; gap: 20px; }
  .ui-theme .source-review { padding: 20px; }
}
@media (max-width:980px) {
  .ui-review-grid { grid-template-columns: minmax(0,1fr); }
  .ui-publish-column { position: static; }
  .ui-theme .source-review .image-input-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ui-theme .automation-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ui-theme .settings-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width:760px) {
  :root { --pad-x: 20px; --gap-section: 22px; }
  .ui-theme .page { padding-top: 24px; }
  .ui-theme .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  .ui-theme .page-heading .primary { display: inline-flex; }
  .ui-theme :where(.metric-grid,.overview,.analytics-metrics) { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .ui-theme :where(.metric-card,.stat,.automation-metrics .metric-card) { padding: 16px; }
  .ui-theme :where(.metric-card strong,.stat>b,.automation-metrics .metric-card strong) { font-size: 26px; }
  .ui-theme :where(.slot,.panel,.settings-section,.source-review,.automation-lite-card) { padding: 18px; }
  .ui-theme .candidates { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .ui-theme .candidate { padding: 18px; }
  .ui-theme .candidate.selected { padding: 17px; }
  .ui-theme .candidate header b { font-size: 16px; }
  .ui-theme .automation-lite-grid { grid-template-columns: minmax(0,1fr); }
  .ui-theme .automation-lite-source { grid-column: auto; }
  .ui-quick-actions { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .ui-quick-actions a { padding: 16px 18px; }
  .ui-theme .source-review .image-input-grid { grid-template-columns: minmax(0,1fr); }
  .ui-workflow { gap: 10px; align-items: flex-start; justify-content: space-between; font-size: 12px; }
  .ui-workflow span { flex: 1; flex-direction: column; gap: 6px; text-align: center; }
  .ui-workflow span+span::before { display: none; }
  .ui-theme .operator-strip { gap: 14px; }
  .ui-theme .operator-strip .secondary { align-self: flex-end; }
  .ui-theme .ui-publish-column { padding: 16px; }
  .ui-theme .source-review textarea[name="draft_text"] { min-height: 240px; }
  .ui-theme .settings-hero-actions { width: 100%; }
  .ui-theme .settings-hero-actions>a { flex: 1 1 auto; }
  .ui-theme .settings-save-dock { left: 12px; right: 12px; width: auto; max-width: none; transform: none; padding: 12px; }
  .ui-theme .settings-save-dock p { font-size: 12px; }
  .ui-theme .settings-summary-card { padding: 14px; gap: 8px; }
  .ui-theme .settings-card-icon { width: 30px; height: 30px; flex: 0 0 30px; font-size: 13px; }
  .ui-theme .settings-summary-card strong { font-size: 16px; }
  .ui-theme .attached-image { grid-template-columns: minmax(0,1fr); }
  .ui-theme .source-review .attached-image img { max-width: 100%; max-height: 320px; }
  .ui-theme .publish-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ui-theme .queue-editor-meta { gap: 10px; flex-wrap: wrap; }
  .ui-theme .source-review .ui-review-heading { align-items: flex-start; }
  .ui-theme .source-review .ui-review-heading>.chip { flex-shrink: 0; }
  .ui-theme .reply-card-top { flex-wrap: wrap; gap: 6px; }
}
@media (max-width:360px) {
  :root { --pad-x: 14px; }
  .ui-theme .app-header-inner { padding-inline: 14px; }
  .ui-theme .brand-copy strong { font-size: 14px; }
  .ui-theme .brand-mark { width: 32px; height: 32px; }
  .ui-theme .settings-summary-grid { grid-template-columns: minmax(0,1fr); }
  .ui-theme .mobile-nav { gap: 0; padding-inline: 6px; }
  .ui-theme .mobile-nav a span,.ui-more-button { font-size: 10px; }
}
@media (prefers-reduced-motion:reduce) {
  .ui-theme *, .ui-theme *::before,.ui-theme *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (forced-colors:active) {
  .ui-theme :where(.card,.primary,.secondary,.candidate,.filter-chip,.ui-publish-column,.settings-summary-card,.ui-quick-actions a) { border: 1px solid CanvasText; }
  .ui-theme .desktop-nav a.active,.ui-theme .mobile-nav a.active { outline: 2px solid Highlight; }
  .ui-theme .ui-nav-icon { forced-color-adjust: auto; }
}
@media print {
  .ui-theme .app-header,.ui-theme .mobile-nav,.ui-theme .settings-save-dock { display:none; }
  .ui-authenticated .page { width:100%; margin:0; padding:0; }
  .ui-publish-column { position: static; }
}
/* Specific compatibility resets for legacy high-specificity declarations. */
.ui-theme .settings-section::before { background: #93add1; }
.ui-theme .settings-section[class*="is-"] .settings-section-number { background: var(--primary-soft); color: var(--primary); }
.ui-theme .settings-role-card { background: #fff; border-color: var(--line); }
.ui-theme .settings-role-grid strong { color: var(--text); }
.ui-theme .automation-zone::before { background: #93add1; }
.ui-theme .automation-zone.zone-emergency::before { background: var(--danger); }
.ui-theme .automation-lite-field input,.ui-theme .automation-lite-field select { border-color: var(--ui-input-border); border-radius: 10px; }
.ui-theme .automation-lite-toggle input { accent-color: var(--primary); }
.ui-theme .automation-lite-save { min-height: 44px !important; }
.ui-theme .automation-lite-step { position: static; flex: 0 0 30px; }
.ui-theme .automation-lite-card header { padding-right: 0; }
.ui-theme .slot-status.status-draft_ready { color: var(--primary); background: var(--primary-soft); }
@media(max-width:760px) { .ui-theme .automation-page .automation-metrics { grid-template-columns: repeat(2,minmax(0,1fr)) !important; } }
.ui-theme .settings-state.is-off { color: var(--muted); background: #edf1f5; }
.ui-theme .history-card header small,.ui-theme .history-card header>span { color: var(--muted); }
.ui-theme .settings-section[class*="is-"]::before { background: #93add1; }
body.ui-theme input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body.ui-theme select,body.ui-theme textarea { border-color: var(--ui-input-border); }
body.ui-theme input:focus,body.ui-theme textarea:focus,body.ui-theme select:focus { border-color: var(--primary); }
