/* Dashboard shell (host).

   The shell is the one piece of chrome the host owns: a fixed vertical navigation, a sticky top bar that
   always shows the app and environment in scope, the production band, and the page canvas. Layout comes
   from the kit's `--pylon-shell-*` tokens; colours come from Tabler. */

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background-color: var(--tblr-body-bg);
  color: var(--tblr-body-color);
  font-family: var(--tblr-body-font-family);
  font-size: var(--tblr-body-font-size);
  line-height: var(--tblr-body-line-height);
}

.shell {
  display: flex;
  min-height: 100vh;
}

/* The navigation drawer's state lives in a checkbox so the shell needs no script and still works before
   the circuit is up. */
.shell-nav-toggle {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* The sidebar is a three-part column: a fixed brand, the navigation (the only part that scrolls) and the
   account footer, so the brand and the signed-in admin never scroll out of reach. */
.shell-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  width: var(--pylon-shell-sidebar-width);
  background-color: var(--tblr-bg-surface);
  border-inline-end: 1px solid var(--tblr-border-color);
  overflow: hidden;
}

.shell-sidebar > .pylon-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 0 0 auto;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--tblr-border-color);
}

.shell-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shell-brand-mark {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: var(--tblr-border-radius);
  background-color: var(--tblr-primary);
  color: var(--tblr-primary-fg);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
}

.shell-brand-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--tblr-emphasis-color);
}

.shell-brand-sub {
  font-size: 0.6875rem;
  line-height: 1rem;
  color: var(--tblr-muted);
}

.shell-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 0 0 auto;
  padding: 0.75rem;
  border-top: 1px solid var(--tblr-border-color);
  background-color: var(--tblr-bg-surface-secondary);
}

.shell-account-email {
  overflow: hidden;
  min-width: 0;
  padding-inline: 0.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tblr-secondary-color);
}

/* The sign-out reads as a sidebar action: full width, icon first, label next to it. */
.shell-sidebar-footer .rz-button {
  width: 100%;
}

.shell-sidebar-footer .rz-button .rz-button-box {
  justify-content: flex-start;
  padding-inline: 0.125rem;
}

.shell-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  margin-inline-start: var(--pylon-shell-sidebar-width);
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: var(--pylon-shell-header-height);
  padding: 0.375rem 1.25rem;
  background-color: color-mix(in oklab, var(--tblr-bg-surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--tblr-border-color);
}

.shell-nav-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--tblr-border-radius);
  color: var(--tblr-body-color);
  cursor: pointer;
}

.shell-nav-button:hover {
  background-color: var(--tblr-active-bg);
}

.shell-nav-button-icon,
.shell-nav-button-icon::before,
.shell-nav-button-icon::after {
  display: block;
  width: 1.125rem;
  height: 2px;
  background-color: currentColor;
  border-radius: 2px;
}

.shell-nav-button-icon {
  position: relative;
}

.shell-nav-button-icon::before,
.shell-nav-button-icon::after {
  position: absolute;
  left: 0;
  content: "";
}

.shell-nav-button-icon::before {
  top: -6px;
}

.shell-nav-button-icon::after {
  top: 6px;
}

.shell-backdrop {
  display: none;
}

.shell-banner {
  position: relative;
  z-index: 1;
}

.shell-session-warning {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  color: var(--tblr-warning-text, #7a4b00);
  background: var(--tblr-warning-lt, #fff3cd);
  border-bottom: 1px solid var(--tblr-warning, #f59f00);
}

.shell-main {
  flex: 1;
  padding: 1.5rem;
}

.shell-content {
  width: 100%;
  max-width: var(--pylon-shell-max-width);
  margin-inline: auto;
}

/* The scope switcher sits in the top bar, compact: the label is a visual affordance only, the select
   keeps its accessible name through `aria-label` (kit `PylonSelect`). */
.app-env-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.app-env-switcher .pylon-field {
  flex: 0 0 auto;
  width: 9rem;
}

/* The select keeps its accessible name through `aria-label` (kit `PylonSelect`), so the visible label
   would only make the top bar taller. */
.app-env-switcher .pylon-field-label,
.app-env-switcher .rz-form-field-label {
  display: none;
}

.app-env-switcher .rz-dropdown {
  border-color: transparent;
  background-color: transparent;
  font-weight: 500;
}

.app-env-switcher .rz-dropdown:hover {
  background-color: var(--tblr-active-bg);
}

.app-env-switcher .rz-dropdown.rz-dropdown-open {
  border-color: var(--tblr-primary);
  background-color: var(--tblr-bg-forms);
}

/* Sign-in: one card on an empty canvas. */
.sign-in {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  background:
    radial-gradient(60rem 30rem at 50% -10%, var(--tblr-primary-lt), transparent 70%),
    var(--tblr-body-bg);
}

.sign-in-card {
  width: 100%;
  max-width: 26rem;
  padding: 1.5rem;
  background-color: var(--tblr-bg-surface);
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius-lg);
  box-shadow: var(--tblr-shadow-lg);
}

.sign-in-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.sign-in-tagline {
  margin: 0 0 0 auto;
  font-size: 0.75rem;
  color: var(--tblr-muted);
}

.sign-in-build {
  margin: 1.25rem 0 0;
  font-size: 0.75rem;
  color: var(--tblr-muted);
  text-align: right;
}

.sign-in form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sign-in .pylon-page-header {
  margin-bottom: 1rem;
}

.sign-in .pylon-field-error {
  margin-top: 0.125rem;
}

.sign-in > p {
  font-size: 0.875rem;
}

@media (max-width: 991.98px) {
  .shell-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease-in-out;
  }

  .shell-body {
    margin-inline-start: 0;
  }

  .shell-nav-toggle:checked ~ .shell-sidebar {
    transform: none;
    box-shadow: var(--tblr-shadow-lg);
  }

  .shell-nav-button {
    display: inline-flex;
  }

  .shell-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1025;
    background-color: light-dark(rgba(24, 36, 51, 0.5), rgba(0, 0, 0, 0.7));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
  }

  .shell-nav-toggle:checked ~ .shell-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .shell-main {
    padding: 1rem;
  }
}

@media (max-width: 767.98px) {
  .app-env-switcher {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .app-env-switcher .pylon-field {
    width: 7.5rem;
  }
}

/* At phone width the top bar keeps one row: the environment stays readable as the select's value (and as
   the production band), so the colour-coded badge is dropped there and returns from 480px up. */
@media (max-width: 480px) {
  .shell-header {
    padding-inline: 0.75rem;
  }

  .app-env-switcher .pylon-env-badge {
    display: none;
  }
}
