/* NEXORA · Admin shell — sidebar navigation for /admin.
   Every rule is scoped under .fx-shell (plus the single body.fx-shell-locked scroll lock)
   so no other route or screen is touched. Dark, minimal, thin borders, 44px targets. */

.fx-shell {
  --fx-ink: var(--foreground, #f3f3f6);
  --fx-muted: #a5a4ae;
  --fx-panel: #17171b;
  --fx-soft: #1f1f25;
  --fx-field: #101013;
  --fx-line: #303036;
  --fx-accent: var(--accent, #979393);
  --fx-shell-rail: 264px;
  --fx-shell-rail-mini: 76px;
  --fx-shell-radius: 10px;
  --fx-shell-top: var(--fx-header-height, 72px);
  --fx-shell-speed: 160ms;
  position: relative;
  display: grid;
  grid-template-columns: var(--fx-shell-rail) minmax(0, 1fr);
  align-items: start;
  flex: 1 0 auto;
  min-width: 0;
  max-width: 100%;
  color: var(--fx-ink);
  background: var(--fx-field);
  border-top: 1px solid var(--fx-line);
  font: 400 14px/1.5 LINESeed, system-ui, sans-serif;
  overflow-wrap: anywhere;
}

.fx-shell,
.fx-shell *,
.fx-shell *::before,
.fx-shell *::after { box-sizing: border-box; }

/* Follow the app's existing light palette so the chrome matches .fx-admin when
   the store is switched to light mode (admin.css ships the same override). */
.light .fx-shell {
  --fx-ink: var(--foreground, #202124);
  --fx-muted: #55555d;
  --fx-panel: #eeeeef;
  --fx-soft: #e2e2e5;
  --fx-field: #f7f7f8;
  --fx-line: #d5d5da;
}

.fx-shell [hidden] { display: none !important; }

.fx-shell :where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--fx-accent);
  outline-offset: 2px;
}

.fx-shell :where(h1, h2, p, ul, ol, li) { margin: 0; padding: 0; }

.fx-shell ul,
.fx-shell ol { list-style: none; }

.fx-shell__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ sidebar */
.fx-shell__side {
  position: sticky;
  top: var(--fx-shell-top);
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100dvh - var(--fx-shell-top));
  min-width: 0;
  padding: 14px 12px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--fx-line);
  background: var(--fx-panel);
  z-index: 4;
}

.fx-shell__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  min-width: 0;
}

.fx-shell__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--fx-line);
  border-radius: 9px;
  background: var(--fx-soft);
  color: var(--fx-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.fx-shell__brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.fx-shell__brand-name { font-size: 14px; font-weight: 700; letter-spacing: .12em; }

.fx-shell__brand-sub { color: var(--fx-muted); font-size: 10px; letter-spacing: .14em; }

.fx-shell__ghost,
.fx-shell__burger,
.fx-shell__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--fx-shell-radius);
  background: transparent;
  color: var(--fx-ink);
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color var(--fx-shell-speed) ease, border-color var(--fx-shell-speed) ease, color var(--fx-shell-speed) ease;
}

.fx-shell__ghost:hover,
.fx-shell__burger:hover,
.fx-shell__action:hover { background: var(--fx-soft); border-color: var(--fx-line); }

.fx-shell__collapse { margin-left: auto; }

.fx-shell__icon { display: block; flex: none; width: 20px; height: 20px; }

.fx-shell__search { display: block; min-width: 0; }

.fx-shell__field {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--fx-line);
  border-radius: var(--fx-shell-radius);
  background: var(--fx-field);
  color: var(--fx-ink);
  font: inherit;
  font-size: 16px;
  transition: border-color var(--fx-shell-speed) ease;
}

.fx-shell__field::placeholder { color: var(--fx-muted); opacity: 1; }

.fx-shell__field:focus { border-color: var(--fx-accent); }

.fx-shell__nav { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.fx-shell__group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.fx-shell__group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--fx-shell-radius);
  background: transparent;
  color: var(--fx-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--fx-shell-speed) ease, background-color var(--fx-shell-speed) ease;
}

.fx-shell__group-toggle:hover { color: var(--fx-ink); background: var(--fx-soft); }

.fx-shell__group-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fx-shell__chevron {
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform var(--fx-shell-speed) ease;
}

.fx-shell__group-toggle[aria-expanded="false"] .fx-shell__chevron { transform: rotate(-45deg); }

.fx-shell__items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.fx-shell__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: var(--fx-shell-radius);
  color: var(--fx-ink);
  text-decoration: none;
  font: inherit;
  transition: background-color var(--fx-shell-speed) ease, border-color var(--fx-shell-speed) ease, color var(--fx-shell-speed) ease;
}

.fx-shell__link:hover { background: var(--fx-soft); border-color: var(--fx-line); }

.fx-shell__link[aria-current="page"],
.fx-shell__link.is-active {
  background: var(--fx-soft);
  border-color: var(--fx-line);
  border-left-color: var(--fx-accent);
  font-weight: 700;
}

.fx-shell__link[aria-current="page"] .fx-shell__icon { color: var(--fx-accent); }

.fx-shell__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fx-shell__no-match {
  padding: 10px 12px;
  color: var(--fx-muted);
  font-size: 13px;
}

.fx-shell__foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--fx-line);
  color: var(--fx-muted);
  font-size: 11px;
  letter-spacing: .06em;
}

/* ------------------------------------------------------------------- column */
.fx-shell__column { display: flex; flex-direction: column; min-width: 0; }

.fx-shell__top {
  position: sticky;
  top: var(--fx-shell-top);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--fx-line);
  background: var(--fx-field);
}

.fx-shell__titles { flex: 1 1 auto; min-width: 0; }

.fx-shell__crumb { color: var(--fx-muted); font-size: 12px; }

.fx-shell__crumb-list { display: flex; flex-wrap: wrap; align-items: center; gap: 0; min-width: 0; }

.fx-shell__crumb-item { display: inline-flex; align-items: baseline; gap: 0; min-width: 0; }

.fx-shell__crumb-sep { color: var(--fx-line); }

.fx-shell__crumb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fx-shell__crumb-text[aria-current="page"] { color: var(--fx-ink); }

.fx-shell__title {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
}

.fx-shell__title:focus-visible { outline: 2px solid var(--fx-accent); outline-offset: 4px; }

.fx-shell__desc { color: var(--fx-muted); font-size: 12px; }

.fx-shell__actions { display: flex; align-items: center; gap: 8px; flex: none; }

.fx-shell__action {
  border-color: var(--fx-line);
  background: var(--fx-panel);
  font-size: 13px;
  text-decoration: none;
}

.fx-shell__action-label { white-space: nowrap; }

.fx-shell__body { min-width: 0; min-height: 50vh; }

.fx-shell .fx-shell-page { display: block; min-width: 0; padding: 16px; }

.fx-shell .fx-shell-page--module { padding-top: 18px; }

.fx-shell__error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: 640px;
  padding: 16px;
  border: 1px solid var(--fx-line);
  border-left: 3px solid #c98b8b;
  border-radius: var(--fx-shell-radius);
  background: var(--fx-panel);
}

.fx-shell__error-title { font-size: 16px; font-weight: 700; }

.fx-shell__error-text { color: var(--fx-muted); font-size: 13px; }

.fx-shell__error-retry { border-color: var(--fx-line); background: var(--fx-soft); }

/* ------------------------------------------------------------ desktop rail */
@media (min-width: 900px) {
  .fx-shell.is-collapsed { grid-template-columns: var(--fx-shell-rail-mini) minmax(0, 1fr); }

  .fx-shell.is-collapsed .fx-shell__side { padding-inline: 10px; }

  .fx-shell.is-collapsed .fx-shell__brand-text,
  .fx-shell.is-collapsed .fx-shell__search,
  .fx-shell.is-collapsed .fx-shell__foot,
  .fx-shell.is-collapsed .fx-shell__group-label { display: none; }

  .fx-shell.is-collapsed .fx-shell__group-toggle { justify-content: center; padding-inline: 0; }

  .fx-shell.is-collapsed .fx-shell__link { justify-content: center; gap: 0; padding-inline: 8px; }

  .fx-shell.is-collapsed .fx-shell__link .fx-shell__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .fx-shell__burger,
  .fx-shell__close,
  .fx-shell__overlay { display: none !important; }
}

/* -------------------------------------------------------------- mobile rail */
@media (max-width: 899.98px) {
  .fx-shell { display: block; }

  .fx-shell__side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    max-width: 320px;
    height: 100dvh;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform var(--fx-shell-speed) ease;
    z-index: 10060;
  }

  .fx-shell.is-drawer-open .fx-shell__side {
    visibility: visible;
    transform: none;
    box-shadow: 24px 0 60px #0006;
  }

  .fx-shell__overlay {
    position: fixed;
    inset: 0;
    display: block;
    border: 0;
    padding: 0;
    background: #000000b8;
    z-index: 10050;
  }

  .fx-shell__collapse { display: none; }

  .fx-shell__top { flex-wrap: wrap; padding: 8px 12px 10px; }

  .fx-shell__titles { flex: 1 1 0; }

  .fx-shell__title { font-size: 17px; }

  .fx-shell__desc { display: none; }

  .fx-shell__action-label { display: none; }

  .fx-shell .fx-shell-page { padding: 12px 10px 24px; }
}

/* 360px: no horizontal overflow on the narrowest screens. */
@media (max-width: 380px) {
  .fx-shell__top { gap: 8px; padding-inline: 10px; }

  .fx-shell__crumb { font-size: 11px; }

  .fx-shell__title { font-size: 16px; }
}

body.fx-shell-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .fx-shell,
  .fx-shell *,
  .fx-shell *::before,
  .fx-shell *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* The storefront cookie notice is a fixed bottom-left dialog; on the back office it
   would sit on top of the sidebar and swallow taps. Hide it only while the shell is up. */
body.fx-shell-active .ref-cookie { display: none !important; }

/* Admin mode owns the viewport: the storefront header, ticker, footer and bottom
   navigation must not sit on top of (or below) the back office. */
body.fx-shell-active{--fx-header-height:0px}
body.fx-shell-active .ref-header,
body.fx-shell-active .ref-footer,
body.fx-shell-active .fx-header-space,
body.fx-shell-active .fx-skip,
body.fx-shell-active nav[aria-label="Mobile Bottom Navigation"]{display:none!important}

/* The extra module ships its own section nav; the sidebar already is the nav. */
body.fx-shell-active .fx-extra [data-fx-nav]{display:none!important}

/* Storefront escape hatch: always visible from the back office. */
.fx-shell__store-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--fx-line);
  border-radius: var(--fx-shell-radius);
  background: var(--fx-soft);
  color: var(--fx-ink);
  text-decoration: none;
  font: inherit;
}
.fx-shell__store-link:hover { border-color: var(--fx-accent); background: var(--fx-panel); }
.fx-shell__store-link .fx-shell__icon { color: var(--fx-accent); }
.fx-shell__store-link .fx-shell__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 900px) {
  .fx-shell.is-collapsed .fx-shell__store-link { justify-content: center; padding-inline: 8px; }
  .fx-shell.is-collapsed .fx-shell__store-link .fx-shell__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}

.fx-shell .fx-shell__group--secondary { border-top: 1px solid var(--fx-line); margin-top: 6px; padding-top: 6px; }
.fx-shell .fx-shell__group--secondary .fx-shell__group-label { flex: 1; text-align: start; }
.fx-shell .fx-shell__action:disabled { cursor: wait; opacity: .65; }
@media (min-width: 900px) {
  .fx-shell.is-collapsed .fx-shell__group--secondary .fx-shell__group-toggle { gap: 5px; }
}
