/* vendored from MilieuCentralWebsite@f1a49d1; edit packages/milieu-shell/milieu-shell.css there, then re-run vendor.ps1 */
/* ==========================================================================
   Milieu shell: the SNRGY app shell (SNRGY product UI rules, section 3)

   The one layout every app shares: the suite bar (served live by Central as
   bar.css/bar.js), a 64px app header with the client's logo and product name,
   a 224px side nav, the page head, the content column, and the "Powered by
   SNRGY" footer.

   Requires milieu-tokens.css first (which brings the theme). Every colour is
   a token; surfaces are flat (1px borders, no shadows); hover shifts tone,
   never position.

   Canonical copy: MilieuCentralWebsite/packages/milieu-shell/milieu-shell.css
   ========================================================================== */

:root {
  --motion-fast: var(--sx-motion, 150ms);
  --motion-base: var(--sx-motion, 150ms);
  --milieu-bar-h: 44px;
  --mshell-header-h: 64px;
  --mshell-nav-w: 224px;
  --mshell-max: 1400px;
  --mshell-gutter: 24px;
}
@media (max-width: 1023px) {
  :root {
    --mshell-gutter: 16px;
  }
}

/* --- Page frame (3.5) ---------------------------------------------------- */

.mshell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--sx-page);
  color: var(--sx-text);
}

/* App header (3.2): 64px, logo mark then "Milieu Product". */
.mshell__header {
  background: var(--sx-surface);
  border-bottom: 1px solid var(--sx-border);
}
.mshell__header-in {
  max-width: var(--mshell-max);
  margin: 0 auto;
  padding: 0 var(--mshell-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--mshell-header-h);
}
.mshell__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mshell__body {
  flex: 1;
  width: 100%;
  max-width: var(--mshell-max);
  margin: 0 auto;
  padding: 24px var(--mshell-gutter) 48px;
  display: grid;
  grid-template-columns: var(--mshell-nav-w) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.mshell__body--full {
  grid-template-columns: minmax(0, 1fr);
}
.mshell__main {
  min-width: 0;
}
/* The content column: the page, then the footer at its foot (3.8). */
.mshell__col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.mshell__col > .mshell__main {
  flex: 1;
}
.mshell__col > .mshell__footer {
  max-width: none;
  margin: 24px 0 0;
  padding: 0;
}
/* Inside .mshell__col the body's own bottom padding is the footer's. */
.mshell__body:has(> .mshell__col) {
  padding-bottom: 24px;
}

/* "Powered by SNRGY" sits right-aligned at the foot of the content column,
   24px below the last content (3.8). On a single-card page (a sign-in, a
   public form) it is centred under the card: add .mshell__footer--centre. */
.mshell__footer {
  width: 100%;
  max-width: var(--mshell-max);
  margin: 0 auto;
  padding: 0 var(--mshell-gutter) 24px;
  display: flex;
  justify-content: flex-end;
}
.mshell__footer--centre {
  justify-content: center;
}
/* Under a single card the line follows the card, 24px below it, rather than
   sitting at the foot of the window. */
.mshell__body:has(+ .mshell__footer--centre) {
  flex: 0 0 auto;
}
/* A page without .mshell__col: the body's bottom padding is the 24px. */
.mshell__body:has(+ .mshell__footer) {
  padding-bottom: 24px;
}

/* --- Lockup (3.2): the logo mark, then the names as live text ------------ */

.milieu-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--sx-text);
  min-width: 0;
}
.milieu-lockup img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--sx-radius-panel);
  flex-shrink: 0;
}
/* "Milieu HR Portal": the organization's short name in 700, the product in
   400, 17px, on one line. */
.milieu-lockup__word {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.25em;
  min-width: 0;
  line-height: 1.2;
  white-space: nowrap;
  font-size: 17px;
}
.milieu-lockup__name {
  font-weight: 700;
}
.milieu-lockup__product {
  font-weight: 400;
  color: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Side navigation (3.3) ----------------------------------------------- */

.mshell__nav {
  position: sticky;
  top: calc(var(--milieu-bar-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mshell__nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mshell__nav-group + .mshell__nav-group {
  margin-top: 16px;
}
/* Group headings: 12px/600, subtle, sentence case. */
.mshell__nav-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 10px;
  margin: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--sx-subtle);
  text-align: left;
  cursor: default;
}
button.mshell__nav-heading {
  cursor: pointer;
  border-radius: var(--sx-radius-control);
}
.mshell__nav-heading svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
/* Only a collapsible heading has a trailing chevron. */
button.mshell__nav-heading svg:last-child {
  margin-left: auto;
}
.mshell__nav-heading[aria-expanded="false"] svg:last-child {
  transform: rotate(-90deg);
}

.mshell__nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--sx-radius-control);
  color: var(--sx-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--sx-motion) ease,
    border-color var(--sx-motion) ease;
}
.mshell__nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--sx-muted);
}
.mshell__nav-link:hover {
  background: var(--sx-surface);
  border-color: var(--sx-border);
}
/* Current item: tint and ink, no bars, no shadows. */
.mshell__nav-link[aria-current="page"] {
  background: var(--brand-tint);
  color: var(--brand-ink);
  font-weight: 600;
}
.mshell__nav-link[aria-current="page"] svg {
  color: currentColor;
}
/* Counter (6.2): 4px radius, 11px/700, neutral. */
.mshell__nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--sx-radius-badge);
  border: 1px solid color-mix(in srgb, var(--sx-neutral-ink) 25%, transparent);
  background: var(--sx-neutral-tint);
  color: var(--sx-neutral-ink);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* --- Page head (3.6): back link, title, rule, description, actions -------- */

.mpage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
/* The back link: its own line above the title, chevron + parent name. */
.mpage-head__back {
  flex: 0 0 100%;
  margin: 0 0 -8px;
  font-size: 13.5px;
  line-height: 1.4;
}
.mpage-head__back a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--sx-muted);
  font-weight: 500;
  text-decoration: none;
}
.mpage-head__back svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.mpage-head__back a:hover,
.mpage-head__back a:focus-visible {
  color: var(--sx-text);
  text-decoration: underline;
}
.mpage-head__eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sx-subtle);
}
.mpage-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--sx-text);
}
.mpage-head .brand-rule {
  margin-top: 8px;
}
.mpage-head__desc {
  margin: 8px 0 0;
  max-width: 640px;
  font-size: 15px;
  color: var(--sx-muted);
}
.mpage-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Section heading (H2, section 4). */
.msection-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

/* --- Small shared pieces ------------------------------------------------- */

/* Icon-only button (6.1): 38x38, needs an aria-label. */
.milieu-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--sx-control);
  border-radius: var(--sx-radius-control);
  background: var(--sx-surface);
  color: var(--sx-text);
  cursor: pointer;
  transition: background-color var(--sx-motion) ease;
}
.milieu-icon-btn:hover {
  background: var(--sx-hover);
}
.milieu-icon-btn svg {
  width: 16px;
  height: 16px;
}

/* Empty state (7.5): inside the container that would hold the content. */
.mempty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--sx-muted);
}
.mempty svg {
  width: 24px;
  height: 24px;
  color: var(--sx-subtle);
}
.mempty strong,
.mempty h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--sx-text);
}
.mempty p {
  margin: 0;
  max-width: 420px;
}

/* Loading (7.4): skeleton blocks in the shape of the content. */
.mskeleton {
  display: block;
  height: 14px;
  border-radius: var(--sx-radius-badge);
  background: var(--sx-sunken);
  animation: mskeleton-pulse 1.2s ease-in-out infinite;
}
@keyframes mskeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* "Powered by SNRGY" (3.8): the SNRGY glyph (snrgy-glyph-light.svg, the
   streams converging into the arrow, no disc; snrgy-glyph-dark.svg on a dark
   surface) at 14px, then the words, 6px apart, 12px, subtle. On hover the
   text turns --sx-text and nothing else changes. */
.powered-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sx-subtle);
  text-decoration: none;
}
a.powered-by:hover {
  color: var(--sx-text);
}
.powered-by img {
  width: 14px;
  height: 14px;
}

/* --- Below 1024px: the Menu button and the drawer (3.4) -------------------

   The contract, for every app (docs/INTEGRATION.md, "The menu on a phone"):
     <button type="button" class="mnav-toggle" aria-expanded="false"
             aria-controls="<the nav's id>" data-milieu-nav-toggle>
       <icon/> <span class="mnav-toggle__label">Menu</span>
       <span class="mnav-toggle__current">the current page</span> <chevron/>
     </button>
     <nav class="mshell__nav" id="..." data-drawer>...</nav>
   Pressing it toggles aria-expanded and the class mnav-open on <html>.

   With data-drawer on the nav (S3.5), the open menu is a left drawer over a
   scrim: the app traps focus in it, closes it on Escape, on the scrim
   (.mnav-scrim) and on navigation, and puts focus back on the button.
   Without data-drawer the older behaviour stays: the menu opens in place
   under the button. Opt in once the app does the focus handling. */

.mnav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--sx-control);
  border-radius: var(--sx-radius-control);
  background: var(--sx-surface);
  color: var(--sx-text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.mnav-toggle svg {
  flex-shrink: 0;
}
.mnav-toggle__current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--sx-muted);
  font-weight: 500;
}
.mnav-toggle__current::before {
  content: "\00B7\00A0";
}
.mnav-toggle svg:last-child {
  margin-left: auto;
}
.mnav-toggle[aria-expanded="false"] svg:last-child {
  transform: rotate(-90deg);
}
.mnav-drawer-head,
.mnav-scrim {
  display: none;
}

@media (max-width: 1023px) {
  .mshell__body {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 16px;
    padding-top: 16px;
  }
  .mnav-toggle {
    display: flex;
  }
  .mshell__body > .mshell__nav,
  .mshell__body .mshell__nav {
    position: static;
    display: none;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--sx-border);
  }
  .mnav-open .mshell__body > .mshell__nav,
  .mnav-open .mshell__body .mshell__nav {
    display: flex;
  }
  .mshell__nav-link {
    min-height: 44px;
    white-space: normal;
  }

  /* The drawer. */
  .mshell__body .mshell__nav[data-drawer] {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1100;
    width: min(320px, 86vw);
    padding: 12px 12px 24px;
    overflow-y: auto;
    background: var(--sx-page);
    border: 0;
    border-right: 1px solid var(--sx-border);
    box-shadow: var(--sx-shadow-float);
  }
  .mnav-open .mshell__body .mshell__nav[data-drawer] {
    display: flex;
  }
  .mnav-open .mnav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 8px;
    padding: 0 0 8px 10px;
    border-bottom: 1px solid var(--sx-border);
    font-size: 16px;
    font-weight: 700;
  }
  .mnav-open .mnav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1090;
    border: 0;
    padding: 0;
    background: var(--sx-scrim);
    cursor: default;
  }
  html.mnav-open:has(.mshell__nav[data-drawer]) {
    overflow: hidden;
  }
}

/* Below 640px: actions wrap under the title (3.4). */
@media (max-width: 639px) {
  .mpage-head__actions {
    flex: 1 1 100%;
  }
  .milieu-lockup__word {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mshell__nav-link,
  .milieu-icon-btn {
    transition: none;
  }
  .mskeleton {
    animation: none;
  }
}

@media print {
  .mshell__nav,
  .mshell__footer,
  .mnav-toggle,
  .mnav-scrim,
  #milieu-bar {
    display: none !important;
  }
  .mshell__body {
    grid-template-columns: minmax(0, 1fr);
  }
}
