/* stacksage global app rail — shared across every page */
:root { --rail-w: 60px; }
#fs-rail {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-w); z-index: 80;
  background: #FAF9F6; color: #37352F;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 0; border-right: 1px solid #E7E4DD;
}
#fs-rail .fs-brand { width: 30px; height: 30px; border-radius: 9px; margin-bottom: 10px; flex: none;
  background: #37352F; box-shadow: 0 1px 4px rgba(26,25,24,.18); }
#fs-account { margin-top: auto; padding-top: 8px; }
#fs-account #fs-acct-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid #E7E4DD;
  background: #F3F1EC; color: #37352F; font: 600 13px "IBM Plex Sans", -apple-system, system-ui, sans-serif;
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, box-shadow .15s; }
#fs-account #fs-acct-btn:hover { background: #37352F; color: #FAF9F6; box-shadow: 0 2px 8px rgba(26,25,24,.22); }
#fs-rail a { position: relative; width: 42px; height: 42px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; color: #97938B; text-decoration: none; transition: background .15s, color .15s; }
#fs-rail a:hover { background: rgba(26,25,24,.05); color: #37352F; }
#fs-rail a.active { background: #F3F1EC; color: #37352F; }
#fs-rail a.active::before { content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: #37352F; }
#fs-rail .fs-tip { position: absolute; left: 52px; top: 50%; transform: translateY(-50%);
  background: #37352F; color: #fff; font: 500 12px/1 ui-sans-serif, system-ui, sans-serif; white-space: nowrap;
  padding: 7px 10px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.3); opacity: 0; pointer-events: none;
  transition: opacity .12s; z-index: 90; }
#fs-rail a:hover .fs-tip { opacity: 1; }
#fs-rail .fs-spacer { flex: 1; }
body { padding-left: var(--rail-w); }

/* Grouped rail: 5 task groups. Multi-item groups reveal a hover flyout. */
#fs-rail .fs-group { position: relative; width: 42px; height: 42px; }
#fs-rail .fs-gicon, #fs-rail a.solo {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: #97938B; cursor: pointer; text-decoration: none; transition: background .15s, color .15s;
}
#fs-rail .fs-group:hover .fs-gicon, #fs-rail a.solo:hover { background: rgba(26,25,24,.05); color: #37352F; }
#fs-rail .fs-group.active .fs-gicon, #fs-rail a.solo.active { background: #F3F1EC; color: #37352F; }
#fs-rail .fs-group.active::before, #fs-rail a.solo.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: #37352F;
}
/* Hover bridge: keeps the group hovered while the pointer crosses to the flyout. */
#fs-rail .fs-group:hover::after { content: ""; position: absolute; top: 0; bottom: 0; left: 40px; width: 20px; }
#fs-rail .fs-flyout {
  position: absolute; left: 50px; top: 50%; z-index: 95;
  transform: translateY(-50%) translateX(-6px);
  background: #fff; border: 1px solid #E7E4DD; border-radius: 12px; min-width: 188px; padding: 6px;
  box-shadow: 0 14px 36px rgba(26,25,24,.18);
  opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
}
#fs-rail .fs-group:hover .fs-flyout, #fs-rail .fs-group:focus-within .fs-flyout {
  opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0);
}
#fs-rail .fs-flyhead {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #97938B; padding: 6px 10px 5px;
}
#fs-rail .fs-flyout a {
  display: block; width: auto; height: auto; border-radius: 8px; padding: 8px 11px;
  font: 500 13.5px/1.2 ui-sans-serif, system-ui, sans-serif; color: #37352F; text-decoration: none; white-space: nowrap;
}
#fs-rail .fs-flyout a:hover { background: rgba(26,25,24,.05); color: #37352F; }
#fs-rail .fs-flyout a.fly-active { background: #F3F1EC; color: #37352F; font-weight: 600; }

/* Floating in-page section switcher for multi-page groups (Systems). Overlays
   content (like the topology HUD) so it works on any page layout. */
#fs-sections {
  position: fixed; top: 12px; left: calc(50% + var(--rail-w) / 2); transform: translateX(-50%);
  z-index: 85; display: flex; gap: 3px; padding: 4px;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid #D2D2D7; border-radius: 12px; box-shadow: 0 6px 20px rgba(26,25,24,.12);
}
#fs-sections a {
  padding: 6px 15px; border-radius: 9px; text-decoration: none;
  font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; color: #6A6A72;
}
#fs-sections a:hover { background: rgba(0,0,0,.05); color: #1d1d1f; }
#fs-sections a.on { background: #F3F1EC; color: #37352F; }

/* Modern geometric-sans display headings (Inter), applied app-wide.
   Pages don't set font-family on headings, so this is the single source. */
:root { --fs-serif: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", ui-sans-serif, sans-serif; }
h1, h2, .page-head h1, .hero h1, .doc h1, .doc h2 {
  font-family: var(--fs-serif); font-weight: 680; letter-spacing: -.025em;
}

/* Themed dropdowns — drop the native gray control + arrow and draw our own
   ink chevron (only truth-state carries colour). !important beats each page's
   `background:` shorthand (which would otherwise reset it) and covers
   dynamically-built selects. */
select {
  -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.6 6 6.4 11 1.6' stroke='%2397938B' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 13px center !important;
  background-size: 12px 8px !important;
  padding-right: 36px !important;
  cursor: pointer;
}
select:hover { border-color: var(--ink, #37352F) !important; }
select option { background: var(--panel, #fff); color: var(--text, #1d1d1f); }

/* Fully themed custom dropdown (shell.js upgrades every native <select>).
   The native element stays in the DOM, hidden but in sync, so all existing
   value reads/writes and change handlers keep working. This themes the OPEN
   list too — the one thing native selects won't let CSS style. */
.fs-select { position: relative; }
.fs-select .fs-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; margin: 0; }
.fs-select-btn {
  width: 100%; text-align: left; font: inherit; color: var(--text, #1d1d1f);
  background: var(--surface-2, #F5F5F7); border: 1px solid var(--border, #D2D2D7);
  border-radius: 10px; padding: 9px 34px 9px 12px; cursor: pointer; position: relative;
  display: block; line-height: 1.35; transition: border-color .14s, box-shadow .14s;
}
.fs-select-btn > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-select-btn::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 12px; height: 8px;
  transform: translateY(-50%);
  background: no-repeat center / 12px 8px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.6 6 6.4 11 1.6' stroke='%2397938B' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transition: transform .16s;
}
.fs-select.open .fs-select-btn::after { transform: translateY(-50%) rotate(180deg); }
.fs-select.open .fs-select-btn, .fs-select-btn:focus-visible {
  outline: none; border-color: var(--ink, #37352F);
  box-shadow: 0 0 0 3px var(--sunken, #F3F1EC);
}
.fs-select-panel {
  display: none; position: absolute; z-index: 300; left: 0; right: 0; top: calc(100% + 5px);
  background: var(--panel, #fff); border: 1px solid var(--border, #D2D2D7); border-radius: 11px;
  box-shadow: 0 12px 34px rgba(26,25,24,.16); padding: 5px; max-height: 300px; overflow-y: auto;
}
.fs-select.open .fs-select-panel { display: block; }
.fs-select.up .fs-select-panel { top: auto; bottom: calc(100% + 5px); }
.fs-optgroup { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint, #ABABB2); padding: 9px 10px 4px; }
.fs-opt { font-size: 14px; color: var(--text, #1d1d1f); padding: 8px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-opt:hover, .fs-opt.active { background: var(--sunken, #F3F1EC); color: var(--ink, #37352F); }
.fs-opt.sel { background: var(--sunken, #F3F1EC); color: var(--ink, #37352F); font-weight: 600; }
.fs-opt.sel::after { content: "✓"; float: right; margin-left: 10px; }
