/* ════════════════════════════════════════════════════════════════════
   arc267 · Fluent skin for the Brainy shell (Office / Windows look)
   Airy, light, precise: a navy title bar that also carries the trial
   notice, a slim module rail on the left instead of the big module
   cards, soft grey workspace, 6 px radii, thin 1 px borders, Segoe UI.
   Brainy's colours are kept: navy, blue, the module colours.
   Loaded last, so it overrides the older look without touching logic.
   ════════════════════════════════════════════════════════════════════ */
:root {
  --fl-font: 'Segoe UI Variable Text', 'Segoe UI', 'DM Sans', system-ui, sans-serif;
  --fl-navy: #0f2d4a;
  --fl-blue: #1a73c9;
  --fl-ink: #1f2937;
  --fl-muted: #5b6573;
  --fl-line: #e3e7ed;
  --fl-bg: #f3f5f8;
  --fl-rail: 84px;
  --fl-title: 44px;
}
html body { background: var(--fl-bg) !important; font-family: var(--fl-font) !important; }

/* ── title bar: the trial notice and the header become one navy band ── */
html body .tia-bar {
  height: 30px !important; min-height: 0 !important; padding: 0 16px !important;
  background: #0b2238 !important; color: #c9d6e4 !important; font: 400 12px var(--fl-font) !important;
  display: flex !important; align-items: center !important; justify-content: center !important; gap: 10px !important;
  border: 0 !important; box-shadow: none !important;
}
html body .tia-bar strong { color: #ffffff !important; font-weight: 600 !important; }
html body .tia-bar button, html body .tia-bar .go {
  height: 22px !important; padding: 0 10px !important; border-radius: 4px !important; font: 600 11.5px var(--fl-font) !important;
  background: transparent !important; color: #ffffff !important; border: 1px solid #ffffff59 !important; box-shadow: none !important;
}
html body .tia-bar button:last-of-type { background: #f5b82e !important; color: var(--fl-navy) !important; border-color: #f5b82e !important; }

html body > header {
  height: var(--fl-title) !important; background: var(--fl-navy) !important; color: #ffffff !important;
  border: 0 !important; box-shadow: 0 1px 0 rgba(0,0,0,.12) !important; padding: 0 10px !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
html body > header .brand, html body > header .brand * { color: #ffffff !important; }
html body > header .brand-name, html body > header .brand-text { font: 700 16px var(--fl-font) !important; letter-spacing: .01em; }
html body > header .brand-bulb { width: 22px !important; height: 22px !important; }
html body > header .file-btn {
  background: var(--fl-blue) !important; box-shadow: none !important; border-radius: 5px !important;
  padding: 0 14px !important; height: 30px !important; font: 600 13px var(--fl-font) !important; letter-spacing: 0 !important;
}
html body > header .file-btn:hover { transform: none !important; background: #1f82e0 !important; }
html body > header .scenario-badge {
  background: #ffffff1a !important; border: 1px solid #ffffff2e !important; color: #ffffff !important;
  border-radius: 5px !important; height: 30px !important; box-shadow: none !important; font-family: var(--fl-font) !important;
}
html body > header .scenario-badge * { color: #ffffff !important; }
html body > header .scenario-badge .sb-eyebrow { color: #c9d6e4 !important; }
html body > header button:not(.file-btn):not(.scenario-badge) { color: #ffffff !important; }
html body > header svg { color: inherit; }

/* ── module rail: the journey cards become a slim vertical rail ── */
html body .journey-ribbon {
  position: fixed !important; left: 0 !important; top: calc(var(--fl-top, 74px)) !important; bottom: 0 !important;
  width: var(--fl-rail) !important; height: auto !important; margin: 0 !important; padding: 10px 0 !important;
  display: flex !important; flex-direction: column !important; align-items: center !important; gap: 2px !important;
  background: #eaeef3 !important; border: 0 !important; border-right: 1px solid var(--fl-line) !important;
  box-shadow: none !important; border-radius: 0 !important; overflow-y: auto !important; overflow-x: hidden !important; z-index: 20 !important;
}
html body .journey-ribbon .jr-phase {
  display: contents !important;
}
html body .journey-ribbon .jr-phase-header, html body .journey-ribbon .jr-fill, html body .journey-ribbon .jr-arrow,
html body .journey-ribbon .jr-stage-verb, html body .journey-ribbon .jr-stage-seq, html body .journey-ribbon .jr-stage-mark,
html body .journey-ribbon .jr-progress, html body .journey-ribbon .jr-phase-meta { display: none !important; }
html body .journey-ribbon .jr-stages { display: contents !important; }
html body .journey-ribbon .jr-stages .jr-stage, html body[data-scenario] .journey-ribbon .jr-stages .jr-stage, html body[data-scenario] .journey-ribbon .jr-stages .jr-stage.on {
  position: relative !important; display: flex !important; flex-direction: column !important; align-items: center !important;
  gap: 4px !important; width: 70px !important; min-width: 0 !important; max-width: none !important; height: auto !important;
  padding: 8px 2px 6px !important; margin: 0 !important; border-radius: 8px !important; border: 1px solid transparent !important;
  background: transparent !important; box-shadow: none !important; transform: none !important; flex: none !important; cursor: pointer;
}
html body .journey-ribbon .jr-stage:hover { background: #ffffffb3 !important; }
html body .journey-ribbon .jr-stage.on {
  background: #ffffff !important; border-color: var(--fl-line) !important; box-shadow: 0 1px 2px rgba(15,23,42,.08) !important;
}
html body .journey-ribbon .jr-stage.on::before {
  content: ''; position: absolute; left: -7px; top: 14px; width: 3px; height: 22px; border-radius: 2px; background: var(--fl-blue);
}
html body .journey-ribbon .jr-stage-num {
  width: 34px !important; height: 34px !important; min-width: 34px !important; border-radius: 9px !important;
  display: flex !important; align-items: center !important; justify-content: center !important; margin: 0 !important; box-shadow: none !important;
}
html body .journey-ribbon .jr-stage-num svg, html body .journey-ribbon .jr-stage.on .jr-stage-num svg { width: 20px !important; height: 20px !important; }
html body .journey-ribbon .jr-stage-body { display: block !important; min-width: 0 !important; padding: 0 !important; text-align: center !important; }
html body .journey-ribbon .jr-stage-name, html body .journey-ribbon .jr-stage.on .jr-stage-name {
  font: 400 10.5px/1.2 var(--fl-font) !important; color: var(--fl-muted) !important; white-space: normal !important;
  text-align: center !important; letter-spacing: 0 !important; margin: 0 !important; max-width: 72px; overflow: visible !important;
  text-overflow: clip !important; word-break: normal; overflow-wrap: anywhere;
}
html body .journey-ribbon .jr-stage-name span { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; display: inline !important; }
html body .journey-ribbon .jr-stage.on .jr-stage-name { color: var(--fl-ink) !important; font-weight: 600 !important; }
html body .journey-ribbon .jr-more-btn { margin: 6px 0 0 !important; align-self: center !important; display: block !important; }
html body .journey-ribbon .jr-more-trigger {
  width: 70px !important; min-height: 0 !important; height: 44px !important; padding: 0 !important; justify-content: center !important;
  border-radius: 8px !important; background: transparent !important; border: 1px dashed #c7d0db !important;
  font: 400 11px var(--fl-font) !important; color: var(--fl-muted) !important;
}
html body .journey-ribbon .jr-more-menu { position: fixed !important; left: calc(var(--fl-rail) + 6px) !important; right: auto !important; top: auto !important;
  border-radius: 8px !important; border: 1px solid var(--fl-line) !important; box-shadow: 0 8px 28px rgba(15,23,42,.16) !important; font-family: var(--fl-font) !important; }

/* ── workspace: the modules sit to the right of the rail, on a soft grey ground ── */
html body main#main { margin-left: var(--fl-rail) !important; background: var(--fl-bg) !important; }
html body .workspace { background: var(--fl-bg) !important; }
html body .frame-wrap { border-radius: 8px !important; }
html body .frame-wrap iframe { background: #ffffff; }
html body .refinery-strip { background: #ffffff !important; border-left: 1px solid var(--fl-line) !important; box-shadow: none !important; }

/* ── scenario window: a Windows dialog — white card, soft shadow, airy tiles ── */
html body .scenario-wall { background: rgba(15, 45, 74, .28) !important; backdrop-filter: blur(6px) !important; }
html body .scenario-wall .sw-card {
  background: #ffffff !important; border: 1px solid var(--fl-line) !important; border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(15,23,42,.08), 0 24px 64px rgba(15,23,42,.22) !important; font-family: var(--fl-font) !important;
  padding: 28px 32px 22px !important; box-sizing: border-box !important;
}
html body .scenario-wall .sw-head { margin: 0 0 18px !important; padding: 0 0 16px !important; }
html body .scenario-wall .sw-head > * { text-align: left !important; margin-left: 0 !important; margin-right: 0 !important; max-width: none !important; }
html body .scenario-wall .sw-close { top: 14px !important; right: 14px !important; background: transparent !important; box-shadow: none !important; }
html body .scenario-wall .sw-close:hover { background: #f1f4f8 !important; }
html body .scenario-wall .sw-head { text-align: left !important; padding-bottom: 6px !important; border-bottom: 1px solid #eef1f5 !important; }
html body .scenario-wall .sw-eyebrow { font: 600 11px var(--fl-font) !important; letter-spacing: .06em !important; color: var(--fl-blue) !important; text-transform: uppercase; opacity: 1 !important; margin-bottom: 6px !important; }
html body .scenario-wall .sw-title { font: 600 24px var(--fl-font) !important; color: var(--fl-ink) !important; letter-spacing: -.01em !important; }
html body .scenario-wall .sw-sub { font: 400 14px var(--fl-font) !important; color: var(--fl-muted) !important; }
html body .scenario-wall .sw-grid { gap: 10px !important; }
html body .scenario-wall .sw-tile {
  background: #ffffff !important; border: 1px solid var(--fl-line) !important; border-radius: 8px !important;
  box-shadow: none !important; transform: none !important; text-align: left !important; font-family: var(--fl-font) !important;
  transition: background .12s, border-color .12s, box-shadow .12s !important;
}
html body .scenario-wall .sw-tile:hover { background: #f5f9fd !important; border-color: #9fc3e8 !important; box-shadow: 0 2px 8px rgba(26,115,201,.12) !important; }
html body .scenario-wall .sw-tile.selected, html body .scenario-wall .sw-tile.is-selected, html body .scenario-wall .sw-tile[aria-pressed="true"] {
  background: #eaf3fc !important; border-color: var(--fl-blue) !important; box-shadow: inset 0 0 0 1px var(--fl-blue) !important;
}
html body .scenario-wall .sw-tile-icon { border-radius: 8px !important; box-shadow: none !important; }
html body .scenario-wall .sw-tile-name { font: 600 14px var(--fl-font) !important; color: var(--fl-ink) !important; }
html body .scenario-wall .sw-tile-desc { font: 400 12.5px/1.45 var(--fl-font) !important; color: var(--fl-muted) !important; }
html body .scenario-wall .sw-preview { background: #f7f9fc !important; border: 1px solid var(--fl-line) !important; border-radius: 8px !important; box-shadow: none !important; }
html body .scenario-wall button:not(.sw-tile):not(.sw-close) {
  border-radius: 5px !important; font-family: var(--fl-font) !important; box-shadow: none !important;
}
html body .scenario-wall .sw-close { border-radius: 5px !important; }

/* ── menus and dialogs of the shell: flat, precise ── */
html body .file-dropdown, html body .fm-panel, html body .file-menu .fm {
  border-radius: 8px !important; border: 1px solid var(--fl-line) !important;
  box-shadow: 0 8px 28px rgba(15,23,42,.16) !important; font-family: var(--fl-font) !important;
}
html body .fm-item { border-radius: 5px !important; }

/* ════════════════════════════════════════════════════════════════════
   arc268 · Every module has its own colour, like the Office apps
   (Word blue, Excel green, PowerPoint red…): the title bar, the rail
   icon and the rail marker take the colour of the module in use.
   Rail order follows the thinking journey:
   Capture → Explore → Connect → Challenge → Develop → Write → Decide → Remember
   ════════════════════════════════════════════════════════════════════ */
html body .jr-stage[data-stage="wall"]              { --mc: #038387; order: 1; }
html body .jr-stage[data-stage="doodle-library"]    { --mc: #0078d4; order: 2; }
html body .jr-stage[data-stage="doodle-combiner"]   { --mc: #8e1b3a; order: 3; }
html body .jr-stage[data-stage="thought-companion"] { --mc: #7719aa; order: 4; }
html body .jr-stage[data-stage="omnisuite"]         { --mc: #217346; order: 5; }
html body .jr-stage[data-stage="composer"]          { --mc: #2b579a; order: 6; }
html body .jr-stage[data-stage="nexus"]             { --mc: #ca5010; order: 7; }
html body .jr-stage[data-stage="memorizer"]         { --mc: #b4009e; order: 8; }
html body .journey-ribbon .jr-more-btn { order: 99 !important; }
html body .journey-ribbon .jr-stages .jr-stage .jr-stage-num {
  background: color-mix(in srgb, var(--mc) 14%, #ffffff) !important; color: var(--mc) !important;
}
html body .journey-ribbon .jr-stages .jr-stage.on .jr-stage-num { background: var(--mc) !important; color: #ffffff !important; }
html body .journey-ribbon .jr-stages .jr-stage.on::before { background: var(--mc) !important; }
html body .journey-ribbon .jr-stages .jr-stage.on .jr-stage-name { color: var(--mc) !important; }

body[data-mod="wall"]              { --mc: #038387; }
body[data-mod="doodle-library"]    { --mc: #0078d4; }
body[data-mod="doodle-combiner"]   { --mc: #8e1b3a; }
body[data-mod="thought-companion"] { --mc: #7719aa; }
body[data-mod="omnisuite"]         { --mc: #217346; }
body[data-mod="composer"]          { --mc: #2b579a; }
body[data-mod="nexus"]             { --mc: #ca5010; }
body[data-mod="memorizer"]         { --mc: #b4009e; }
html body[data-mod] > header { background: var(--mc) !important; transition: background .2s ease; }
html body[data-mod] > header .file-btn { background: color-mix(in srgb, var(--mc) 72%, #000000) !important; }
html body[data-mod] > header .file-btn:hover { background: color-mix(in srgb, var(--mc) 60%, #000000) !important; }

/* arc269 ─ modules a scenario does not need stay behind "…" (More) */
html body[data-scenario] .journey-ribbon .jr-stages .jr-stage.hidden-by-scenario { display: none !important; }
/* arc269 ─ the File menu opens above the module rail, fully visible */
html body > header { z-index: 60 !important; position: relative !important; }
html body > header .file-dropdown { z-index: 70 !important; }
/* arc269 ─ no horizontal rules under the title bar */
html body > header { box-shadow: none !important; border-bottom: 0 !important; }

/* arc269 · scenario window in the Office look, with the module colours */
html body .scenario-wall .sw-tile { border-top: 0 !important; }
html body .scenario-wall .sw-tile .sw-tile-icon { background: color-mix(in srgb, var(--tc, #1a73c9) 12%, #ffffff) !important; color: var(--tc, #1a73c9) !important; }
html body .scenario-wall .sw-tile:hover { border-color: color-mix(in srgb, var(--tc, #1a73c9) 45%, #ffffff) !important; }
html body .scenario-wall .sw-mods { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
html body .scenario-wall .sw-mod {
  font: 600 10.5px var(--fl-font); color: var(--mc); background: color-mix(in srgb, var(--mc) 10%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--mc) 30%, #ffffff); border-radius: 999px; padding: 1px 8px;
}
/* arc269 ─ the File menu keeps dark words on its white panel */
html body > header .file-dropdown button, html body > header .file-dropdown .fm-item,
html body > header .file-dropdown .fm-item-name { color: var(--fl-ink) !important; }
html body > header .file-dropdown .fm-item-sub, html body > header .file-dropdown .fm-label { color: var(--fl-muted) !important; }
html body > header .file-dropdown .fm-item:hover { background: #f1f5fa !important; }

/* ── arc269 ─────────────────────────────────────────────────────────── */
/* modules not needed by the scenario stay behind "More" */
html body[data-scenario] .journey-ribbon .jr-stages .jr-stage.hidden-by-scenario { display: none !important; }
/* the File menu opens above the module rail, never under it */
html body > header { position: relative !important; z-index: 60 !important; overflow: visible !important; }
html body > header .file-menu, html body > header .file-dropdown, html body > header [class*="fm-"] { z-index: 61 !important; }


/* ════════════════════════════════════════════════════════════════════
   arc269 · fixes
   ════════════════════════════════════════════════════════════════════ */
/* a scenario keeps only its own modules in the rail; the others wait behind "More" */
html body[data-scenario] .journey-ribbon .jr-stages .jr-stage.hidden-by-scenario { display: none !important; }
/* the File menu opens above the module rail, whole */
html body > header { position: relative !important; z-index: 60 !important; }
html body > header .file-dropdown { z-index: 80 !important; }
html body .journey-ribbon { z-index: 30 !important; }
/* Connect is wine red, not PowerPoint red */
html body .jr-stage[data-stage="doodle-combiner"], body[data-mod="doodle-combiner"] { --mc: #8b1d3b !important; }
/* arc274 · Reflect: always in the rail (every scenario), petrol blue, at the bottom */
html body .jr-stage[data-stage="reflect"], body[data-mod="reflect"] { --mc: #0b6a86; order: 20; }
html body[data-scenario] .journey-ribbon .jr-stages .jr-stage[data-stage="reflect"].hidden-by-scenario { display: flex !important; }

/* ════════════════════════════════════════════════════════════════════
   arc336 · the module rail waits at the left edge as a slim "Modules" tab
   and slides open while the mouse is over it (desktop with a mouse only;
   phones and touch screens keep their layout)
   ════════════════════════════════════════════════════════════════════ */
@media (hover: hover) and (min-width: 761px) {
  :root { --fl-peek: 26px; }
  html body .journey-ribbon {
    transform: translateX(calc(var(--fl-peek) - var(--fl-rail))) !important;
    transition: transform .22s cubic-bezier(.4,0,.2,1) .3s, box-shadow .22s .3s !important;
    overflow: hidden !important; z-index: 70 !important;
  }
  html body .journey-ribbon > * { opacity: 0; transition: opacity .15s .3s; }
  html body .journey-ribbon::after {
    content: "Modules"; position: absolute; top: 0; right: 0; bottom: 0; width: var(--fl-peek);
    display: flex; align-items: center; justify-content: center;
    writing-mode: vertical-rl; transform: rotate(180deg);
    font: 600 12px/1 "Segoe UI", system-ui, sans-serif; letter-spacing: 2px; text-transform: uppercase;
    color: #ffffff; background: var(--fl-accent, #0078d4);
    transition: opacity .15s .3s; pointer-events: none; z-index: 50;
  }
  html body .journey-ribbon:hover, html body .journey-ribbon:focus-within, html body .journey-ribbon.jr-keep {
    transform: translateX(0) !important; overflow-y: auto !important;
    transition-delay: 0s !important;
    box-shadow: 6px 0 22px rgba(15,30,50,.18) !important;
  }
  html body .journey-ribbon:hover > *, html body .journey-ribbon:focus-within > *, html body .journey-ribbon.jr-keep > * { opacity: 1; transition-delay: 0s; }
  html body .journey-ribbon:hover::after, html body .journey-ribbon:focus-within::after, html body .journey-ribbon.jr-keep::after { opacity: 0; transition-delay: 0s; }
  html body main#main { margin-left: var(--fl-peek) !important; }
}

/* arc336 · the More menu lives in the page (outside the sliding rail) */
body > .jr-more-menu { border-radius: 8px; border: 1px solid #d7dee8; box-shadow: 0 8px 28px rgba(15,23,42,.16); font-family: "Segoe UI", system-ui, sans-serif; }
