/* R122: complete theme coverage, compact centered navigation, visible pipeline content, and explicit Home access. */
:root {
  --r122-page: #05050a;
  --r122-page-soft: #0c0b13;
  --r122-panel: rgba(17, 17, 27, .72);
  --r122-panel-solid: #11111b;
  --r122-control: rgba(255,255,255,.052);
  --r122-control-hover: rgba(255,255,255,.09);
  --r122-text: #f7f6f3;
  --r122-muted: rgba(247,246,243,.58);
  --r122-faint: rgba(247,246,243,.39);
  --r122-line: rgba(255,255,255,.095);
  --r122-line-strong: rgba(255,255,255,.16);
  --r122-shadow: 0 28px 80px -46px rgba(96,47,222,.62), inset 0 1px 0 rgba(255,255,255,.045);
  --r122-purple: #8154ff;
  --r122-purple-soft: #b99cff;
  --r122-orange: #ffad69;
  --r122-green: #55dca3;
}

html[data-theme="light"] {
  --r122-page: #f7f5fa;
  --r122-page-soft: #efebf5;
  --r122-panel: rgba(255,255,255,.84);
  --r122-panel-solid: #ffffff;
  --r122-control: rgba(255,255,255,.92);
  --r122-control-hover: #ffffff;
  --r122-text: #18131f;
  --r122-muted: rgba(24,19,31,.64);
  --r122-faint: rgba(24,19,31,.44);
  --r122-line: rgba(47,32,68,.12);
  --r122-line-strong: rgba(47,32,68,.19);
  --r122-shadow: 0 28px 74px -48px rgba(74,42,130,.30), inset 0 1px 0 rgba(255,255,255,.95);
}

html,
body.r120-rice-ui {
  background-color: var(--r122-page) !important;
}

body.r120-rice-ui {
  color: var(--r122-text) !important;
  background:
    radial-gradient(760px 520px at 90% -12%, color-mix(in srgb, var(--r122-purple) 15%, transparent), transparent 68%),
    radial-gradient(720px 520px at -12% 108%, color-mix(in srgb, var(--r122-orange) 9%, transparent), transparent 66%),
    var(--r122-page) !important;
}

/* Route isolation: dashboard content can never sit behind another module. */
body.r120-rice-ui:not([data-active-page="dashboard"]) [data-app-page="dashboard"],
body.r120-rice-ui:not([data-active-page="dashboard"]) #dashboardHome,
body.r120-rice-ui [data-app-page].app-page-hidden,
body.r120-rice-ui [data-app-pages].app-page-hidden {
  display: none !important;
}
body.r120-rice-ui[data-active-page="dashboard"] #dashboardHome:not(.app-page-hidden) {
  display: block !important;
}

/* Explicit Home control shown on every non-dashboard page. */
.r122-home-button {
  order: 0;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-width: 126px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 15px !important;
  border-radius: 999px !important;
  color: var(--r122-text) !important;
  background: var(--r122-control) !important;
  border: 1px solid var(--r122-line) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 14%, transparent) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  white-space: nowrap;
  transform: none !important;
}
body.r120-rice-ui:not([data-active-page="dashboard"]) .r122-home-button { display: inline-flex !important; }
.r122-home-button:hover {
  color: var(--r122-text) !important;
  background: var(--r122-control-hover) !important;
  border-color: color-mix(in srgb, var(--r122-purple) 35%, var(--r122-line)) !important;
  transform: translateY(-1px) !important;
}
.r122-home-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Header alignment and controls. */
body.r120-rice-ui .app-header {
  gap: 14px !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--r122-page) 97%, transparent), color-mix(in srgb, var(--r122-page) 82%, transparent) 78%, transparent) !important;
}
body.r120-rice-ui .header-tools {
  min-width: 0 !important;
  gap: 10px !important;
}
body.r120-rice-ui .r119-command-trigger,
body.r120-rice-ui .topbar-health,
body.r120-rice-ui .premium-theme-switcher,
body.r120-rice-ui .r120-notification {
  color: var(--r122-text) !important;
  background: var(--r122-control) !important;
  border-color: var(--r122-line) !important;
}
body.r120-rice-ui .r119-command-trigger span,
body.r120-rice-ui .r119-command-trigger kbd,
body.r120-rice-ui .topbar-health span { color: var(--r122-muted) !important; }
body.r120-rice-ui .premium-theme-switcher button { color: var(--r122-muted) !important; }
body.r120-rice-ui .premium-theme-switcher button:hover { color: var(--r122-text) !important; background: color-mix(in srgb, var(--r122-purple) 9%, transparent) !important; }
body.r120-rice-ui .premium-theme-switcher button.active {
  color: var(--r122-text) !important;
  background: var(--r122-panel-solid) !important;
  border: 1px solid var(--r122-line) !important;
  box-shadow: 0 7px 18px rgba(18,10,30,.12) !important;
}

/* Compact, centered, non-obstructive dock in both themes. */
body.r120-rice-ui .r119-bottom-dock {
  left: calc(50% + 44px) !important;
  right: auto !important;
  bottom: 14px !important;
  width: min(900px, calc(100vw - 138px)) !important;
  max-width: min(900px, calc(100vw - 138px)) !important;
  transform: translateX(-50%) !important;
  pointer-events: none;
}
body.r120-rice-ui .r119-dock-inner {
  pointer-events: auto;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 3px !important;
  width: 100% !important;
  min-height: 66px !important;
  padding: 7px 9px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  border-radius: 22px !important;
  color: var(--r122-text) !important;
  background: color-mix(in srgb, var(--r122-panel-solid) 88%, transparent) !important;
  border: 1px solid var(--r122-line) !important;
  box-shadow: 0 22px 62px rgba(10,6,18,.22), inset 0 1px 0 color-mix(in srgb, #fff 22%, transparent) !important;
  backdrop-filter: blur(28px) saturate(155%);
  scrollbar-width: thin;
}
body.r120-rice-ui .r119-dock-button {
  position: relative !important;
  flex: 0 0 72px !important;
  width: 72px !important;
  min-width: 72px !important;
  min-height: 52px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  padding: 3px 2px !important;
  color: var(--r122-muted) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  transform: none !important;
  overflow: visible !important;
}
body.r120-rice-ui .r119-dock-button::before { display: none !important; }
body.r120-rice-ui .r119-dock-button:hover,
body.r120-rice-ui .r119-dock-button.active {
  color: var(--r122-text) !important;
  background: color-mix(in srgb, var(--r122-purple) 10%, transparent) !important;
  transform: translateY(-2px) !important;
}
body.r120-rice-ui .r119-dock-icon {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  color: var(--r122-text) !important;
  background: var(--r122-control) !important;
  border: 1px solid var(--r122-line) !important;
  box-shadow: none !important;
}
body.r120-rice-ui .r119-dock-button.active .r119-dock-icon {
  color: #fff !important;
  background: linear-gradient(135deg, #8c5cff, #653ee6) !important;
  border-color: rgba(255,255,255,.23) !important;
  box-shadow: 0 10px 24px -14px rgba(111,61,231,.95) !important;
}
body.r120-rice-ui .r119-dock-label {
  display: block !important;
  max-width: 68px !important;
  overflow: hidden !important;
  color: inherit !important;
  font-size: 8px !important;
  font-weight: 600 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

/* Dashboard: correctly themed surfaces and real, visible button content. */
body.r120-rice-ui .r120-dashboard,
body.r120-rice-ui .r120-dashboard * { box-sizing: border-box; }
body.r120-rice-ui .r120-dashboard { color: var(--r122-text) !important; }
body.r120-rice-ui .r120-overview-heading h2,
body.r120-rice-ui .r120-overview-heading h2 span,
body.r120-rice-ui .r120-kpi-value,
body.r120-rice-ui .r120-card-heading h3,
body.r120-rice-ui .r120-quick-launch h3 { color: var(--r122-text) !important; }
body.r120-rice-ui .r120-overview-heading p,
body.r120-rice-ui .r120-kpi-head,
body.r120-rice-ui .r120-kpi-card p,
body.r120-rice-ui .r120-card-heading span,
body.r120-rice-ui .r120-chart-footer,
body.r120-rice-ui .r120-terminal-title,
body.r120-rice-ui .r120-pipeline-summary,
body.r120-rice-ui .r120-quick-launch header span { color: var(--r122-muted) !important; }
body.r120-rice-ui .r120-kpi-card,
body.r120-rice-ui .r120-glass-card,
body.r120-rice-ui .r120-quick-launch {
  color: var(--r122-text) !important;
  background: var(--r122-panel) !important;
  border-color: var(--r122-line) !important;
  box-shadow: var(--r122-shadow) !important;
}
body.r120-rice-ui .r120-kpi-card.pink {
  background: linear-gradient(135deg, color-mix(in srgb, var(--r122-purple) 28%, var(--r122-panel-solid)), color-mix(in srgb, #7b35ca 20%, var(--r122-panel-solid))) !important;
}

body.r120-rice-ui .r120-pipeline-card .r120-pipeline-list {
  display: grid !important;
  gap: 9px !important;
}
body.r120-rice-ui .r120-pipeline-card .r120-pipeline-list > button {
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 64px !important;
  display: grid !important;
  grid-template-columns: minmax(0,1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 11px 13px !important;
  overflow: hidden !important;
  color: var(--r122-text) !important;
  background: var(--r122-control) !important;
  border: 1px solid var(--r122-line) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  text-align: left !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}
body.r120-rice-ui .r120-pipeline-card .r120-pipeline-list > button::before { display: none !important; }
body.r120-rice-ui .r120-pipeline-card .r120-pipeline-list > button:hover {
  color: var(--r122-text) !important;
  background: var(--r122-control-hover) !important;
  border-color: color-mix(in srgb, var(--r122-purple) 35%, var(--r122-line)) !important;
  transform: translateY(-1px) !important;
}
body.r120-rice-ui .r120-pipeline-list > button > span {
  position: relative !important;
  z-index: 2 !important;
  display: block !important;
  min-width: 0 !important;
  color: var(--r122-text) !important;
  opacity: 1 !important;
  visibility: visible !important;
}
body.r120-rice-ui .r120-pipeline-list button b {
  display: block !important;
  color: var(--r122-text) !important;
  font-size: 12px !important;
  opacity: 1 !important;
  visibility: visible !important;
}
body.r120-rice-ui .r120-pipeline-list button small {
  display: block !important;
  margin-top: 4px !important;
  color: var(--r122-muted) !important;
  font-size: 9px !important;
  opacity: 1 !important;
  visibility: visible !important;
}
body.r120-rice-ui .r120-pipeline-list em {
  position: relative !important;
  z-index: 2 !important;
  opacity: 1 !important;
  visibility: visible !important;
}
body.r120-rice-ui .r120-module-grid > button {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0 !important;
  color: var(--r122-text) !important;
  background: var(--r122-control) !important;
  border: 1px solid var(--r122-line) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  transform: none !important;
}
body.r120-rice-ui .r120-module-grid > button::before { display: none !important; }
body.r120-rice-ui .r120-module-grid > button:hover { background: var(--r122-control-hover) !important; transform: translateY(-1px) !important; }
body.r120-rice-ui .r120-module-grid > button > span { display: block !important; min-width: 0 !important; }
body.r120-rice-ui .r120-module-grid b { color: var(--r122-text) !important; }
body.r120-rice-ui .r120-module-grid small { color: var(--r122-muted) !important; }

/* Complete light mode for every original R103 module, not just the dashboard. */
html[data-theme="light"] body.r120-rice-ui .shell { color: var(--r122-text) !important; }
html[data-theme="light"] body.r120-rice-ui .section-nav.canva-rail {
  background: rgba(249,247,252,.94) !important;
  border-right-color: var(--r122-line) !important;
  box-shadow: 16px 0 44px -40px rgba(70,42,120,.34) !important;
}
html[data-theme="light"] body.r120-rice-ui .section-nav.canva-rail .nav-item,
html[data-theme="light"] body.r120-rice-ui .rail-create { color: #665c72 !important; }
html[data-theme="light"] body.r120-rice-ui .section-nav.canva-rail .nav-item:hover,
html[data-theme="light"] body.r120-rice-ui .rail-create:hover { color: #1d1725 !important; background: rgba(116,74,195,.07) !important; }
html[data-theme="light"] body.r120-rice-ui .section-nav.canva-rail .nav-item.active {
  color: #20172c !important;
  background: #fff !important;
  border-color: rgba(120,76,212,.28) !important;
  box-shadow: 0 14px 34px -23px rgba(112,64,215,.55), inset 0 0 0 1px rgba(124,78,216,.08) !important;
}
html[data-theme="light"] body.r120-rice-ui .section-nav.canva-rail .nav-item svg,
html[data-theme="light"] body.r120-rice-ui .section-nav.canva-rail .rail-create svg { color: currentColor !important; fill: currentColor !important; }
html[data-theme="light"] body.r120-rice-ui .app-header { border-bottom-color: rgba(47,32,68,.08) !important; }

html[data-theme="light"] body.r120-rice-ui :where(
  .card,
  .workspace-card,
  .subpanel,
  .automation-preflight-shell,
  .workflow-choice-panel,
  .reference-examples-panel,
  .competitor-research-panel,
  .api-setup-card,
  .deployment-card,
  .results-card,
  .batch-results-card,
  .digital-template-builder,
  .variation-analysis-card,
  .product-history-card,
  .batch-result-card,
  .approval-product-card,
  .variation-result-card,
  .generation-monitor,
  .image-studio-card,
  .competitor-research-card,
  .automation-health-tile,
  details
) {
  color: var(--r122-text) !important;
  background: rgba(255,255,255,.86) !important;
  border-color: var(--r122-line) !important;
  box-shadow: 0 24px 66px -48px rgba(65,38,116,.26), inset 0 1px 0 rgba(255,255,255,.98) !important;
}
html[data-theme="light"] body.r120-rice-ui :where(.card,.workspace-card,.subpanel,details):hover {
  border-color: rgba(122,79,212,.22) !important;
}
html[data-theme="light"] body.r120-rice-ui :where(h1,h2,h3,h4,h5,h6,strong,label,summary) { color: var(--r122-text) !important; }
html[data-theme="light"] body.r120-rice-ui :where(p,small,.help,.muted,.helper-note,.field-help,.automation-preflight-results) { color: var(--r122-muted) !important; }

/* Light module hero is intentionally light instead of a gray veil with black-on-gray text. */
html[data-theme="light"] body.r120-rice-ui .luxury-automation-hero {
  color: #1d1725 !important;
  background:
    radial-gradient(560px 360px at 92% 4%, rgba(126,84,230,.20), transparent 72%),
    radial-gradient(540px 360px at 3% 100%, rgba(255,174,104,.14), transparent 72%),
    linear-gradient(135deg,#ffffff 0%,#f0ecf8 58%,#e8e0f7 100%) !important;
  border-color: rgba(62,41,92,.13) !important;
  box-shadow: 0 36px 86px -50px rgba(77,45,138,.35), inset 0 1px 0 #fff !important;
}
html[data-theme="light"] body.r120-rice-ui .luxury-automation-hero :where(h1,h2,h3) { color: #1c1524 !important; }
html[data-theme="light"] body.r120-rice-ui .luxury-automation-hero p { color: rgba(28,21,36,.64) !important; }
html[data-theme="light"] body.r120-rice-ui .luxury-automation-kicker { color: #8b4d22 !important; }
html[data-theme="light"] body.r120-rice-ui .luxury-canvas-card {
  background: rgba(255,255,255,.72) !important;
  border-color: rgba(61,40,91,.13) !important;
  box-shadow: 0 28px 65px -40px rgba(65,38,116,.30) !important;
}
html[data-theme="light"] body.r120-rice-ui .luxury-canvas-grid span { background: linear-gradient(135deg,rgba(126,84,230,.09),rgba(91,206,247,.10)) !important; }
html[data-theme="light"] body.r120-rice-ui .luxury-floating-chip,
html[data-theme="light"] body.r120-rice-ui .hero-setup-pill {
  color: #43384f !important;
  background: rgba(255,255,255,.90) !important;
  border-color: rgba(58,38,86,.12) !important;
  box-shadow: 0 14px 30px -22px rgba(53,31,96,.32) !important;
}
html[data-theme="light"] body.r120-rice-ui .hero-primary,
html[data-theme="light"] body.r120-rice-ui button:not(.secondary):not(.ghost):not(.danger):not(.nav-item):not(.rail-logo):not(.rail-create):not(.rail-footer-button):not(.premium-theme-switcher button):not(.r119-dock-button):not(.r120-notification):not(.r122-home-button):not(.r119-command-trigger) {
  color: #fff !important;
}
html[data-theme="light"] body.r120-rice-ui .hero-secondary,
html[data-theme="light"] body.r120-rice-ui button.secondary,
html[data-theme="light"] body.r120-rice-ui button.ghost,
html[data-theme="light"] body.r120-rice-ui a.button.secondary,
html[data-theme="light"] body.r120-rice-ui .icon-button.secondary {
  color: #2b2135 !important;
  background: rgba(255,255,255,.91) !important;
  border-color: rgba(47,32,68,.14) !important;
}
html[data-theme="light"] body.r120-rice-ui .workspace-section-heading { color: var(--r122-text) !important; }
html[data-theme="light"] body.r120-rice-ui .workspace-section-heading h2 { color: #1d1725 !important; }
html[data-theme="light"] body.r120-rice-ui .workspace-section-heading p { color: rgba(29,23,37,.61) !important; }

html[data-theme="light"] body.r120-rice-ui :where(input,textarea,select,.input-like) {
  color: #201827 !important;
  background: rgba(255,255,255,.94) !important;
  border-color: rgba(47,32,68,.17) !important;
  box-shadow: inset 0 1px 2px rgba(32,20,49,.035) !important;
}
html[data-theme="light"] body.r120-rice-ui :where(input,textarea)::placeholder { color: rgba(32,24,39,.39) !important; }
html[data-theme="light"] body.r120-rice-ui :where(.drop-zone,.csv-drop-card,.reference-drop-card,.digital-file-drop-card,.variation-keyword-drop-zone,.upload-zone) {
  color: #51465d !important;
  background: rgba(250,248,253,.94) !important;
  border-color: rgba(47,32,68,.17) !important;
}
html[data-theme="light"] body.r120-rice-ui :where(.status,.pill,.tag,.history-status) {
  color: #44384f !important;
  background: rgba(246,242,250,.92) !important;
  border-color: rgba(47,32,68,.13) !important;
}
html[data-theme="light"] body.r120-rice-ui :where(table) {
  color: #201827 !important;
  background: #fff !important;
  border-color: var(--r122-line) !important;
}
html[data-theme="light"] body.r120-rice-ui :where(thead th,table th) {
  color: #594c65 !important;
  background: rgba(80,56,116,.055) !important;
  border-color: var(--r122-line) !important;
}
html[data-theme="light"] body.r120-rice-ui tbody td { color: #2d2436 !important; border-color: rgba(47,32,68,.08) !important; }
html[data-theme="light"] body.r120-rice-ui tbody tr:nth-child(even) { background: rgba(79,52,118,.025) !important; }
html[data-theme="light"] body.r120-rice-ui tbody tr:hover { background: rgba(129,84,255,.065) !important; }
html[data-theme="light"] body.r120-rice-ui footer { color: rgba(29,23,37,.48) !important; }
html[data-theme="light"] body.r120-rice-ui footer code { color: #43384f !important; background: rgba(78,53,113,.07) !important; }

/* The dashboard itself is fully light when Light is selected. */
html[data-theme="light"] body.r120-rice-ui .r120-orb { opacity: .52 !important; filter: saturate(.9) brightness(1.12); }
html[data-theme="light"] body.r120-rice-ui .r120-kpi-card.pink { background: linear-gradient(135deg,#efe8ff,#e4d7ff) !important; }
html[data-theme="light"] body.r120-rice-ui .r120-kpi-card.pink :where(.r120-kpi-value,.r120-kpi-head) { color: #281b39 !important; }
html[data-theme="light"] body.r120-rice-ui .r120-chart-grid path { stroke: rgba(46,31,66,.075) !important; }
html[data-theme="light"] body.r120-rice-ui .r120-pipeline-list em.ready,
html[data-theme="light"] body.r120-rice-ui .r120-pipeline-list em.synced { color:#14865b !important; background:#ecfaf4 !important; border-color:#bcebd7 !important; }
html[data-theme="light"] body.r120-rice-ui .r120-pipeline-list em.stable { color:#1476a3 !important; background:#edf8fd !important; border-color:#c6e8f6 !important; }
html[data-theme="light"] body.r120-rice-ui .r120-pipeline-list em.build { color:#a76513 !important; background:#fff8e9 !important; border-color:#f4dfb4 !important; }

/* Command palette in Light mode. */
html[data-theme="light"] .r119-command-overlay { background: rgba(28,20,40,.28) !important; }
html[data-theme="light"] .r119-command-panel {
  color: #201827 !important;
  background: rgba(255,255,255,.97) !important;
  border-color: rgba(47,32,68,.15) !important;
  box-shadow: 0 42px 120px rgba(45,29,72,.23) !important;
}
html[data-theme="light"] .r119-command-item { color: #403448 !important; }
html[data-theme="light"] .r119-command-item:hover { color: #17131f !important; background: rgba(129,84,255,.075) !important; }

@media (max-width: 1180px) {
  body.r120-rice-ui .r122-home-button { min-width: 44px !important; width: 44px !important; padding: 0 !important; }
  body.r120-rice-ui .r122-home-button span { display: none !important; }
  body.r120-rice-ui .r119-bottom-dock { left: calc(50% + 34px) !important; width: min(820px, calc(100vw - 100px)) !important; max-width: min(820px, calc(100vw - 100px)) !important; }
}
@media (max-width: 880px) {
  body.r120-rice-ui .r119-bottom-dock { left: calc(50% + 28px) !important; width: calc(100vw - 88px) !important; max-width: calc(100vw - 88px) !important; }
  body.r120-rice-ui .r119-dock-inner { justify-content: flex-start !important; }
}
@media (max-width: 620px) {
  body.r120-rice-ui .r122-home-button { display: none !important; }
  body.r120-rice-ui .r119-bottom-dock { left: 8px !important; right: 8px !important; width: auto !important; max-width: none !important; transform: none !important; }
  body.r120-rice-ui .r119-dock-button { flex-basis: 62px !important; width: 62px !important; min-width: 62px !important; }
  body.r120-rice-ui .r119-dock-label { max-width: 58px !important; font-size: 7.5px !important; }
}
