/*
 * The one product's frame: the left nav (three sections) and the top bar. One file, served by Snappy at /shell/shell.css
 * and linked by both apps: Snappy's pages (app/Shell.tsx) and SOP Snap's pages under /procedures (its embedded mode), so
 * the two draw the same frame from the same rules. The markup is built from the same model (web/src/shell/navModel.ts,
 * GET /api/shell/nav). Tokens are its own (--shx-*), copied from the shared design system (Paper and Graphite), so neither
 * app's own variables can change how it looks.
 */
:where(.shx-side, .shx-top, .shx-scrim) {
  --shx-ground: #f1efea;
  --shx-surface: #ffffff;
  --shx-sunken: #e9e6e0;
  --shx-line: #d8d5d1;
  --shx-ink: #131319;
  --shx-ink-2: #34353c;
  --shx-ink-3: #4e4f56;
  --shx-brand: #5d32c9;
  --shx-brand-text: #5d32c9;
  --shx-brand-tint: #efeeff;
  --shx-ring: #5d32c9;
  --shx-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shx-mono: "IBM Plex Mono", ui-monospace, monospace;
  --shx-side-w: 240px;
  --shx-top-h: 64px;
  box-sizing: border-box;
  font-family: var(--shx-sans);
}
:where([data-theme="graphite"], html.dark) :where(.shx-side, .shx-top, .shx-scrim) {
  --shx-ground: #0d0d10;
  --shx-surface: #1b1b20;
  --shx-sunken: #070709;
  --shx-line: #34353a;
  --shx-ink: #f6f6f9;
  --shx-ink-2: #d3d4d7;
  --shx-ink-3: #b3b4b9;
  --shx-brand: #7153dd;
  --shx-brand-text: #ada3ff;
  --shx-brand-tint: #231e3f;
  --shx-ring: #a193fc;
}
.shx-side *,
.shx-top * {
  box-sizing: border-box;
}

/* ---------------------------------------------------------------- Left nav */
.shx-side {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex: 0 0 var(--shx-side-w);
  flex-direction: column;
  gap: 20px;
  width: var(--shx-side-w);
  height: 100vh;
  height: 100dvh;
  padding: 20px 12px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--shx-line);
  background: var(--shx-surface);
  color: var(--shx-ink-2);
}
.shx-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.shx-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--shx-ink);
  text-decoration: none;
}
.shx-brand-mark {
  flex: none;
  color: var(--shx-brand);
}
.shx-brand-text {
  display: flex;
  flex-direction: column;
}
.shx-brand-name {
  font-size: 16px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.shx-brand-by {
  font-size: 12px;
  line-height: 16px;
  color: var(--shx-ink-3);
}
.shx-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.shx-section-label {
  margin: 0;
  padding: 0 10px 6px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.88px;
  text-transform: uppercase;
  color: var(--shx-ink-3);
}
/* A section's name is its fold: press it to hide or show its pages. Folded, it shows its items' counts added up. */
.shx-section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 28px;
  margin-bottom: 4px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 150ms ease-out,
    color 150ms ease-out;
}
.shx-section-toggle:hover {
  background: var(--shx-sunken);
  color: var(--shx-ink);
}
.shx-section-toggle:focus-visible {
  outline: 2px solid var(--shx-ring);
  outline-offset: 1px;
}
.shx-section-name {
  flex: 1;
  min-width: 0;
  /* Written as shown in the nav model ("SOPs" keeps its lower-case s). */
  text-transform: none;
}
.shx-section-toggle .shx-count {
  letter-spacing: 0;
  text-transform: none;
}
.shx-section-chev {
  flex: none;
  width: 14px;
  height: 14px;
  transition: transform 150ms ease-out;
}
.shx-section[data-folded="true"] .shx-section-chev {
  transform: rotate(-90deg);
}
.shx-items[hidden] {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .shx-section-chev,
  .shx-section-toggle {
    transition: none;
  }
}
.shx-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.shx-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--shx-ink-2);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 150ms ease-out,
    color 150ms ease-out;
}
.shx-link:hover {
  background: var(--shx-sunken);
  color: var(--shx-ink);
}
.shx-link[aria-current="page"] {
  background: var(--shx-brand-tint);
  color: var(--shx-brand-text);
}
.shx-link:focus-visible,
.shx-brand:focus-visible,
.shx-who:focus-visible,
.shx-icon-btn:focus-visible {
  outline: 2px solid var(--shx-ring);
  outline-offset: 2px;
}
.shx-icon {
  flex: none;
  width: 16px;
  height: 16px;
}
.shx-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.shx-count {
  margin-left: auto;
  font-family: var(--shx-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--shx-ink-3);
}

/* The person, at the foot: a button that opens the account menu just above it. */
.shx-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--shx-line);
}
.shx-account {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}
.shx-account[hidden] {
  display: none;
}
.shx-who {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--shx-ink);
  cursor: pointer;
}
.shx-who:hover {
  background: var(--shx-sunken);
}
.shx-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--shx-brand-tint);
  color: var(--shx-brand-text);
  font-family: var(--shx-mono);
  font-size: 12px;
  font-weight: 500;
}
.shx-who-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.shx-who-name {
  overflow: hidden;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.shx-who-role {
  font-size: 13px;
  line-height: 18px;
  color: var(--shx-ink-3);
}
.shx-who .shx-icon {
  color: var(--shx-ink-3);
  transition: transform 150ms ease-out;
}
.shx-who[aria-expanded="true"] .shx-icon {
  transform: rotate(180deg);
}

/* ---------------------------------------------------------------- Top bar */
.shx-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--shx-top-h);
  padding: 0 24px;
  border-bottom: 1px solid var(--shx-line);
  background: var(--shx-ground);
  color: var(--shx-ink);
}
.shx-top-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.shx-top-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--shx-ink);
  color: var(--shx-ground);
  font-family: var(--shx-mono);
  font-size: 12px;
  font-weight: 500;
}
.shx-top-name {
  overflow: hidden;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.shx-top-end {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.shx-icon-btn {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--shx-ink);
  cursor: pointer;
}
.shx-icon-btn:hover {
  background: var(--shx-sunken);
}
.shx-icon-btn .shx-icon {
  width: 20px;
  height: 20px;
}
.shx-scrim {
  display: none;
}

/* ---------------------------------------------------------------- Phone and small tablet: the nav is a drawer */
@media (max-width: 899px) {
  .shx-side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 96;
    width: min(300px, 86vw);
    box-shadow: 0 12px 32px rgba(23, 24, 30, 0.16);
    transform: translateX(-105%);
    visibility: hidden;
    transition:
      transform 200ms ease-out,
      visibility 0s linear 200ms;
  }
  .shx-side[data-open="true"] {
    transform: none;
    visibility: visible;
    transition: transform 200ms ease-out;
  }
  .shx-scrim[data-open="true"] {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: block;
    background: rgba(13, 13, 16, 0.36);
  }
  .shx-icon-btn {
    display: inline-flex;
  }
  .shx-top {
    gap: 8px;
    padding: 0 12px 0 8px;
  }
  .shx-top-mark {
    display: none;
  }
}
@media (min-width: 900px) {
  .shx-side .shx-icon-btn {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .shx-side,
  .shx-side[data-open="true"],
  .shx-link,
  .shx-who .shx-icon {
    transition: none;
  }
}
@media print {
  .shx-side,
  .shx-top,
  .shx-scrim {
    display: none !important;
  }
}

/* A fold of pages inside a section (Results, Training, People...): a row like a page, with a chevron; its pages open under
   it, indented, without icons. Lit when one of its pages is the open one. */
.shx-fold .shx-fold-chev {
  flex: none;
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--shx-ink-3);
  transform: rotate(-90deg);
  transition: transform 150ms ease-out;
}
.shx-fold[aria-expanded="true"] .shx-fold-chev {
  transform: rotate(0deg);
}
.shx-fold[data-lit="true"] {
  color: var(--shx-ink);
}
.shx-subitems {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px;
  padding: 0 0 0 30px;
  list-style: none;
}
.shx-subitems[hidden] {
  display: none;
}
.shx-subitems .shx-link {
  height: 32px;
  font-size: 13.5px;
}
.shx-subitems .shx-icon:empty {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .shx-fold .shx-fold-chev {
    transition: none;
  }
}
