/* Side bar (topbar-mockups.html, option E): a soft indigo bar, so it is never mistaken for the browser's dark frame.
   Desktop: the wordmark, a row of Treatment / Study icons and the fold button, every tab under a Treatment and a
   Study heading (Treatment has the ways into a treatment: pain, hara, indication, which open the matching door of
   the Assess step; Study has Meridians, Methods, Anatomy, Practice, Quiz), and your name at the foot. The Treatment
   and Indications tabs stay in the page for the code that opens them, but are not listed. Folds to icons only.
   On phones: a row at the bottom showing one half, with the switch in the header. */
:root { --nav-w: 184px; --nav-ink: #3c4696; --nav-line: #4b5bdc40; }
:root.nav-folded { --nav-w: 52px; }
.sidenav.mode { position: fixed; z-index: 6; inset-block: 0; inset-inline-start: 0; width: var(--nav-w); display: flex; flex-direction: column; gap: 2px;
  padding: 8px 8px 6px; margin: 0; border-radius: 0; background: var(--indigo-soft); border-inline-end: 1px solid #cdd2f5; overflow: hidden auto; scrollbar-width: none; transition: width .18s; }
.app { margin-inline-start: var(--nav-w); transition: margin .18s; }
/* Desktop, as in Claude: wordmark; a row of Treatment / Study icons and fold; all tabs under two headings; your
   name at the foot (account-ui.js), or Settings when there is no account (settings.js). */
.sidenav .sn-head { flex: none; padding: 4px 8px 10px; font: 800 16px/1.2 "Plus Jakarta Sans", system-ui, sans-serif; color: var(--ink); white-space: nowrap; }
.sidenav .sn-head b { color: var(--indigo); }
.sidenav .sn-head img { display: block; height: 22px; width: auto; }
.sidenav .sn-tools { flex: none; display: flex; align-items: center; gap: 2px; padding: 0 2px 8px; margin-bottom: 2px; border-bottom: 1px solid var(--nav-line); }
.sn-tools .sn-gap { flex: 1; }
.sidenav .sn-k { flex: none; padding: 10px 8px 3px; font: 700 10px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: #7d86c4; }
.sidenav.mode .sn-sub { padding-inline-start: 26px; font-size: 12px; }
.sidenav.mode .sn-sub svg { width: 17px; height: 17px; }
.nav-folded .sidenav.mode .sn-sub { padding-inline-start: 0; }
.sidenav .sn-short { display: none; }
.sidenav .sn-foot { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--nav-line); }
.sidenav.mode .sn-user { width: 100%; gap: 8px; padding: 6px; }
.sidenav.mode .sn-user svg { width: 18px; height: 18px; }
.sn-user .acct-av { width: 28px; height: 28px; flex: none; font-size: 13px; }
.sn-user.unread .acct-av { box-shadow: 0 0 0 2px var(--indigo-soft), 0 0 0 4px var(--pain, #e5484d); }
.sn-who { flex: 1; min-width: 0; display: grid; }
.sn-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--ink); }
.sn-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 11px; color: #6b74b8; }
.sn-who small.low { color: var(--pain, #e5484d); font-weight: 700; }
.sidenav.mode .sn-user .sn-caret { width: 14px; height: 14px; flex: none; color: #6b74b8; }
.sidenav .sn-user[hidden] { display: none; }
.sidenav.mode button[hidden] { display: none !important; } /* Practice is hidden until the user has gone over its cards */
.sidenav.mode button { display: flex; align-items: center; gap: 9px; min-height: 0; padding: 7px 8px; border: 0; border-radius: 10px; background: none; box-shadow: none;
  color: var(--nav-ink); font: 600 12.5px/1.2 "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; text-align: start; overflow-wrap: anywhere; }
.sidenav.mode button svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidenav.mode button:hover { background: #4b5bdc1f; }
.sidenav.mode button.on, .sidenav.mode button.on[data-mode] { background: var(--indigo); color: #fff; box-shadow: none; }
.sidenav .sep { display: none; flex: none; width: 70%; height: 1px; margin: 6px auto; background: var(--nav-line); }
.sidenav.mode [data-mode="treat"], .sidenav.mode [data-mode="ind"], .sidenav [data-mode="ind"] + .sep { display: none; }
/* The Treatment / Study switch: words on the open bar (stacked when a language's words are too long to sit side
   by side), icons when folded. */
.side-seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 10px; background: #4b5bdc24; }
.sidenav .side-seg { flex: none; background: none; padding: 0; }
.sn-tools .side-seg button, .sidenav.mode .sn-tools .side-seg button { flex: none; padding: 6px; }
.sn-tools .side-seg button span { display: none; }
.sn-tools .side-seg button svg { display: block; }
.side-seg button, .sidenav.mode .side-seg button { flex: 1 1 auto; justify-content: center; gap: 5px; min-height: 0; padding: 6px 6px; border: 0; border-radius: 8px; background: none; box-shadow: none;
  color: var(--nav-ink); font: 600 11.5px/1.2 "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; white-space: nowrap; overflow-wrap: normal; }
.side-seg button svg { display: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-seg button:hover { background: #4b5bdc1f; }
.side-seg button[aria-pressed="true"], .sidenav.mode .side-seg button[aria-pressed="true"] { background: var(--indigo); color: #fff; }
.side-seg button:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.sidenav.mode .fold { flex: none; justify-content: center; padding: 6px; color: #6b74b8; }
/* The panel icon (Lucide panel-left): its line stands on the side the bar is on, so it mirrors in right-to-left. */
[dir="rtl"] .sidenav .fold svg { scale: -1 1; }
.nav-folded .sidenav :is(.sn-head, .sn-k, .sn-gap) { display: none; }
.nav-folded .sidenav .sn-tools { flex-direction: column; padding-bottom: 6px; }
.nav-folded .sidenav.mode .sn-user .acct-av { display: grid; }
.nav-folded .sidenav.mode .sn-user .sn-caret { display: none; }
.nav-folded .sidenav.mode { padding-inline: 4px; }
.nav-folded .sidenav.mode button { justify-content: center; padding: 9px 0; }
.nav-folded .sidenav.mode button span { display: none; }
.nav-folded .sidenav .side-seg { flex-direction: column; flex-wrap: nowrap; }
.nav-folded .sidenav .side-seg button { padding: 6px 0; }
.nav-folded .sidenav .side-seg button svg { display: block; }
/* The same switch in the header, for phones. */
.side-top { display: none; flex-wrap: nowrap; border: 1px solid #cdd2f5; background: var(--indigo-soft); }

/* Narrow desktop windows: a slimmer bar leaves the body its room. */
@media (min-width: 861px) and (max-width: 1100px) { :root:not(.nav-folded) { --nav-w: 164px; } }
@media (max-width: 860px) {
  .sidenav.mode { inset-block: auto 0; inset-inline: 0; width: auto; height: 58px; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-inline-end: 0; border-top: 1px solid #cdd2f5; overflow: auto hidden; }
  .sidenav.mode button { flex: 1 0 52px; display: grid; justify-items: center; gap: 2px; padding: 5px 2px 3px; font-size: 10px; line-height: 1.15; text-align: center; }
  .nav-folded .sidenav.mode { padding-inline: 6px; }
  .nav-folded .sidenav.mode button { padding: 5px 2px 3px; }
  .nav-folded .sidenav.mode button span { display: block; }
  .sidenav .sep { display: block; width: 1px; height: auto; margin: 8px 2px; }
  .sidenav :is(.sn-head, .sn-tools, .sn-k, .sn-foot) { display: none; }
  /* Watch the flow: a tab of its own on the Study side, with a short name. */
  .sidenav.mode .sn-sub { padding-inline-start: 2px; font-size: 10px; }
  [data-side="treat"] .sidenav.mode .sn-sub { display: none; }
  .sidenav.mode .sn-sub .sn-long { display: none; }
  .sidenav.mode .sn-sub .sn-short { display: block; }
  /* Phones: the bottom row shows one half at a time; the switch in the header picks which. */
  [data-side="treat"] .sidenav.mode [data-mode], [data-side="treat"] .sidenav .sep, [data-side="study"] .sidenav.mode [data-way] { display: none; }
  .side-top { display: flex; }
  .app { margin-inline-start: 0; padding-bottom: 58px; }
}
/* Small phones: the header also holds the account and settings buttons, so the switch shows its icons only. */
@media (max-width: 480px) {
  .side-top button { padding: 7px 9px; }
  .side-top button span { display: none; }
  .side-top button svg { display: block; }
}
