/*
 * admin-shell-layout.css — structural chrome shared by GolfKit admin workspaces.
 *
 * This file owns the stable application frame: topbar, viewport grid, sidebar,
 * navigation states, content panels and the mobile drawer hand-off. It loads
 * after admin-foundation.css and before each app stylesheet so a shell can theme
 * these primitives without re-declaring their layout.
 */

/* ── Viewport frame ───────────────────────────────────────────── */
.admin-hero {
  /* The rail carries global navigation weight. Keep the workspace header
   * neutral so route context, scope controls and account actions scan clearly
   * across every tenant theme. */
  --admin-header-bg: #ffffff;
  --admin-header-accent: var(--accent);
  --admin-header-text: #1e293b;
  --admin-header-text-rgb: 30, 41, 59;
  --admin-header-control-hover: #f3f4f6;
  --admin-header-brand-font: 'DM Sans', 'Ubuntu', sans-serif;
  position: sticky;
  top: 0;
  box-sizing: border-box;
  width: calc(100% + var(--admin-shell-rail-reserve, 0px));
  margin-inline-start: calc(-1 * var(--admin-shell-rail-reserve, 0px));
  height: var(--admin-header-h);
  background: var(--admin-header-bg) center 60% / cover no-repeat;
  z-index: 50;
  opacity: 1;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px -8px rgba(15, 23, 42, 0.18);
  transition: opacity var(--dur-slow) ease;
}

/* Access prompts have no desktop rail, so their header must not reserve its width. */
body.admin-shell-auth-prompt .admin-hero {
  margin-inline-start: 0;
  width: 100%;
}

.admin-page {
  --admin-nav-reveal-duration: 0.35s;
  --admin-nav-reveal-easing: ease-in-out;
  position: relative;
  z-index: 10;
  min-height: 100dvh;
}

.admin-header {
  height: var(--admin-header-h);
  padding: 0;
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  padding-inline-start: calc(var(--admin-shell-rail-reserve, 0px) + var(--space-lg));
}

.admin-header-left,
.admin-header-right {
  display: flex;
  align-items: center;
}

.admin-header-left {
  gap: 0;
  min-width: 0;
}
.admin-header-right {
  gap: var(--space-lg);
  margin-inline-start: auto;
}

.admin-wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--admin-header-text);
  font-family: var(--admin-header-brand-font);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.admin-wordmark__accent { color: var(--admin-header-accent); }

.admin-header-wordmark { display: inline-flex; flex: 0 0 auto; }
.admin-header-wordmark { text-decoration: none; }
.admin-header-wordmark:hover { opacity: 0.96; }
.admin-header-wordmark:focus-visible {
  outline: 3px solid rgba(var(--admin-header-text-rgb), 0.72);
  outline-offset: 2px;
}

body.admin-shell-auth-prompt .admin-nav-collapse-toggle,
body.admin-shell-auth-prompt .admin-route-context { display: none; }

@media (min-width: 901px) {
  .admin-header-wordmark { display: none; }
}

@media (min-width: 721px) and (max-width: 900px) {
  /* The intermediate rail owns the brand when it opens over the workspace. */
  .admin-header-wordmark { display: none; }
}

.admin-body {
  display: grid;
  grid-template-columns: var(--admin-nav-w) minmax(0, 1fr);
  --admin-shell-rail-reserve: var(--admin-nav-w);
  min-height: 100dvh;
  align-items: start;
  transition: opacity var(--dur-slow) ease;
}

.admin-workspace {
  grid-column: 2;
  min-width: 0;
  /* Fixed tooltips use viewport coordinates, so expose the rail as a safe-area
   * inset rather than allowing wide bubbles to clamp underneath navigation. */
  --tooltip-viewport-inset-left: var(--admin-shell-rail-reserve, 0px);
}

/* Temporary rail reveal uses a fixed viewport veil rather than filtering the
 * workspace box. Filters expand their painted bounds and previously produced
 * a document-level horizontal scrollbar while the compact rail was open. */
.admin-page::after {
  position: fixed;
  z-index: 55;
  inset: 0 0 0 var(--admin-nav-compact-w);
  background: rgba(var(--black-rgb), 0.035);
  backdrop-filter: blur(1.25px);
  content: '';
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--admin-nav-reveal-duration) var(--admin-nav-reveal-easing),
    visibility 0s linear var(--admin-nav-reveal-duration);
  visibility: hidden;
}

body.admin-shell-auth-prompt .admin-body {
  --admin-shell-rail-reserve: 0px;
  grid-template-columns: 0 minmax(0, 1fr);
}
body.admin-shell-auth-prompt .admin-nav { display: none; }
body.admin-shell-auth-prompt .admin-workspace {
  grid-column: 1 / -1;
  width: 100%;
}
body.admin-shell-auth-prompt .admin-header-wordmark { display: inline-flex; }

/* A standalone console opens resolving its session and draws nothing until it
 * knows whether to show the workspace or the access card; without it a
 * signed-in reload flashes the sign-in layout first. The delayed animation
 * shows the page anyway if the console never settles. */
body.admin-shell-resolving .admin-page {
  opacity: 0;
  animation: admin-shell-resolve-timeout 0s linear 4s forwards;
}
@keyframes admin-shell-resolve-timeout { to { opacity: 1; } }

/* The access card every admin console shows when signed out or without
 * access: the tenant and platform shells (admin-auth.js) and Extras Stock. */
.au-signin-btn      { display: inline-flex; align-items: center; gap: 8px; padding: 12px 32px; border: none; border-radius: var(--radius-btn, 8px); background: var(--primary); color: var(--card); font-size: 15px; font-weight: 500; font-family: inherit; cursor: pointer; transition: background .15s; }
.au-screen          { display: flex; align-items: center; justify-content: center; min-height: 60vh; text-align: center; width: 100%; }
.au-card            { background: var(--card); border-radius: var(--radius-card, 12px); box-shadow: var(--shadow-lg); padding: 48px clamp(40px, 5vw, 64px); }
.au-card-icon       { font-size: 48px; margin-bottom: 16px; }
.au-card-title      { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.au-card-text       { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.au-card-text--unavail { margin-bottom: 0; }

body.admin-shell-nav-motion-ready .admin-body {
  transition:
    grid-template-columns var(--admin-nav-reveal-duration) var(--admin-nav-reveal-easing),
    opacity var(--dur-slow) ease;
}

body.admin-shell-nav-compact .admin-body {
  --admin-shell-rail-reserve: var(--admin-nav-compact-w);
  grid-template-columns: var(--admin-nav-compact-w) minmax(0, 1fr);
}

/* A visible compact rail stays visually open while only the workspace reserve
 * moves into its pinned position. The compact class is released after this
 * grid transition, so the rail never replays an opening animation. */
body.admin-shell-nav-compact.admin-shell-nav-pinning .admin-body {
  --admin-shell-rail-reserve: var(--admin-nav-w);
  grid-template-columns: var(--admin-nav-w) minmax(0, 1fr);
}

/* ── Navigation trigger and current route context ─────────────── */
.admin-nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  margin-inline-end: var(--space-xl);
  padding: 10px;
  border: 1px solid rgba(var(--admin-header-text-rgb), 0.35);
  border-radius: var(--radius-btn);
  background: rgba(var(--admin-header-text-rgb), 0.12);
  color: var(--admin-header-text);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background var(--dur), border-color var(--dur);
}

.admin-route-context {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: min(360px, 34vw);
  margin-inline-start: var(--space-lg);
  color: var(--admin-header-text);
}

.admin-route-context__icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  margin-inline-end: var(--space-sm);
  flex: 0 0 auto;
}
.admin-route-context__icon .nav-ic {
  width: 18px;
  height: 18px;
}
.admin-route-context__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}
.admin-route-context__scope,
.admin-route-context__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-route-context__scope {
  color: rgba(var(--admin-header-text-rgb), 0.68);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.035em;
}
.admin-route-context__label {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
}

.admin-nav-toggle:hover,
body.admin-shell-mobile-drawer-open .admin-nav-toggle {
  background: rgba(var(--admin-header-text-rgb), 0.2);
}

.admin-nav-toggle:focus-visible {
  outline: 3px solid rgba(var(--admin-header-text-rgb), 0.72);
  outline-offset: 2px;
}

.admin-nav-toggle__line {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: currentColor;
  transition: transform var(--dur), opacity var(--dur);
}

body.admin-shell-mobile-drawer-open .admin-nav-toggle__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.admin-shell-mobile-drawer-open .admin-nav-toggle__line:nth-child(2) { opacity: 0; }
body.admin-shell-mobile-drawer-open .admin-nav-toggle__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Sidebar navigation ───────────────────────────────────────── */
.admin-nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  background: var(--admin-nav-bg);
  box-shadow: var(--admin-nav-edge-shadow);
  opacity: 1;
  transition:
    width var(--admin-nav-reveal-duration, var(--dur-slow)) var(--admin-nav-reveal-easing, ease-in-out),
    padding var(--dur-slow) ease,
    opacity var(--dur-slow) var(--ease-emphasized),
    transform var(--dur-slow) var(--ease-emphasized),
    visibility 0s linear;
}

.admin-nav gk-tooltip[block] { display: block; }

.admin-nav-shell-header {
  display: flex;
  align-items: center;
  flex: 0 0 var(--admin-header-h);
  min-height: 0;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid rgba(var(--admin-nav-text-rgb), 0.12);
  background: var(--admin-nav-bg);
}

.admin-nav-content {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 0 var(--space-md);
  scrollbar-color: rgba(var(--admin-nav-text-rgb), 0.36) transparent;
  scrollbar-width: thin;
}
.admin-nav-content::-webkit-scrollbar {
  width: 8px;
}
.admin-nav-content::-webkit-scrollbar-track {
  background: transparent;
}
.admin-nav-content::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  background: rgba(var(--admin-nav-text-rgb), 0.36);
  background-clip: padding-box;
}
.admin-nav-content::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--admin-nav-text-rgb), 0.58);
  background-clip: padding-box;
}

/* Account actions belong with global navigation rather than the route header.
 * Keeping this region outside the scrollable route inventory makes sign-out
 * consistently reachable without consuming workspace-header space. */
.admin-nav-footer {
  display: grid;
  flex: 0 0 auto;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-top: 1px solid rgba(var(--admin-nav-text-rgb), 0.12);
  background: var(--admin-nav-bg);
}
.admin-nav-footer[hidden] { display: none; }
.admin-nav-account {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-sm);
}
.admin-nav-account .admin-identity {
  align-items: flex-start;
  flex: 1 1 auto;
}
/* Keep the signed-in identity and compact global actions on one efficient row. */
.admin-nav-footer #oauthUserWrap {
  align-items: center;
  flex-direction: row;
}
.admin-nav-account-tooltip {
  min-width: 36px;
  flex: 0 0 36px;
}
.admin-nav-account-tooltip:has(> .u-hidden) {
  display: none !important;
}
.admin-nav-account-action__icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
.admin-nav-account .admin-nav-account-action--icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  padding: 8px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  font-size: 0;
}
.admin-nav-account .oauth-user-email {
  display: block;
  overflow: hidden;
  max-width: 100%;
  color: var(--admin-nav-label-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-nav-account .btn-signout {
  flex: 0 0 auto;
  border-color: rgba(var(--admin-nav-text-rgb), 0.24);
  color: var(--admin-nav-text);
}
.admin-nav-account .btn-signout:hover {
  background: var(--admin-nav-hover-bg);
  color: var(--admin-nav-hover-text);
}
.admin-nav-account .btn-super-admin {
  border-color: var(--admin-nav-text);
  background: var(--admin-nav-text);
  color: var(--admin-nav-bg);
}
.admin-nav-account .btn-super-admin:hover {
  border-color: var(--admin-nav-hover-bg);
  background: var(--admin-nav-hover-bg);
  color: var(--admin-nav-hover-text);
}
.admin-nav-account :is(.btn-signout, .btn-super-admin):focus-visible {
  outline: 3px solid var(--admin-nav-text);
  outline-offset: 2px;
}
.admin-nav-account .btn-google-signin {
  width: 100%;
  justify-content: center;
  border-color: var(--admin-nav-text);
  background: var(--admin-nav-text);
  color: var(--admin-nav-bg);
}
.admin-nav-account .btn-google-signin:hover {
  border-color: var(--admin-nav-hover-bg);
  background: var(--admin-nav-hover-bg);
  color: var(--admin-nav-hover-text);
}

.admin-nav-wordmark {
  color: var(--admin-nav-text);
  text-decoration: none;
}
.admin-nav-wordmark .admin-wordmark__accent { color: var(--admin-nav-brand-accent); }
.admin-nav-wordmark--product {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  line-height: 1.1;
}
.admin-nav-wordmark__brand {
  color: var(--admin-nav-text);
  font-size: 18px;
  font-weight: 700;
}
.admin-nav-wordmark__product {
  max-width: 100%;
  overflow: hidden;
  color: var(--admin-nav-text);
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-nav-wordmark:hover { opacity: 0.96; }
.admin-nav-wordmark:focus-visible {
  outline: 3px solid var(--admin-nav-text);
  outline-offset: 2px;
}

body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-shell-header {
  justify-content: flex-start;
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-shell-header .admin-nav-collapse-toggle { margin-inline-end: 0; }
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-wordmark { display: none; }

.admin-nav-collapse-toggle {
  display: inline-flex;
  width: 36px;
  height: 36px;
  padding: 8px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--admin-nav-text);
  cursor: pointer;
  flex: 0 0 auto;
  margin-inline-end: var(--space-lg);
  transition:
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    opacity var(--dur-fast) var(--ease);
}

.admin-nav-collapse-toggle:hover {
  background: var(--admin-nav-hover-bg);
  color: var(--admin-nav-text);
}

.admin-nav-collapse-toggle:focus-visible {
  outline: 3px solid var(--admin-nav-text);
  outline-offset: 2px;
}

.admin-nav-collapse-toggle gk-icon {
  width: 18px;
  height: 18px;
}

.admin-nav-item__label {
  display: inline-block;
  overflow: hidden;
  min-width: 0;
  max-width: 176px;
  opacity: 1;
  text-overflow: ellipsis;
  transform: translateX(0);
  transition:
    max-width var(--dur-slow) var(--ease-emphasized),
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
  white-space: nowrap;
}

body.admin-shell-nav-open .admin-nav-item__label {
  transition-delay: 0s, var(--dur-fast), var(--dur-fast);
}

#adminNavDrawer .admin-nav {
  position: static;
  display: block;
  height: auto;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}
#adminNavDrawer .admin-nav-shell-header { display: none; }
#adminNavDrawer .admin-nav-content {
  overflow: visible;
  padding: 0 0 var(--space-md);
}

.admin-nav-brand {
  margin: 0 var(--space-sm) var(--space-lg);
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
  border-bottom: 1px solid rgba(var(--admin-nav-text-rgb), 0.12);
}

.admin-nav-brand__label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--admin-nav-label-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-nav-brand__name {
  display: block;
  overflow-wrap: anywhere;
  color: var(--admin-nav-text);
  font-size: 15px;
  line-height: 1.35;
}

.admin-nav-label {
  overflow: hidden;
  max-height: 44px;
  padding: var(--space-2xl) var(--space-3xl) var(--space-xs);
  color: var(--admin-nav-label-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 1;
  text-transform: uppercase;
  transform: translateX(0);
  transition:
    max-height var(--dur-slow) var(--ease-emphasized),
    padding-block var(--dur-slow) var(--ease-emphasized),
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

body.admin-shell-nav-open .admin-nav-label {
  transition-delay: 0s, 0s, var(--dur-fast), var(--dur-fast);
}

.admin-nav-item.nav-hidden { display: none !important; }
.admin-nav-item {
  position: relative;
  display: flex;
  text-decoration: none;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 44px;
  padding: 7px 14px;
  appearance: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--admin-nav-item-text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition:
    width var(--dur-slow) var(--ease-emphasized),
    padding var(--dur-slow) var(--ease-emphasized),
    gap var(--dur-slow) var(--ease-emphasized),
    background var(--dur),
    color var(--dur);
}

.admin-nav-item .nav-ic {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--admin-nav-icon-text);
}
.admin-nav-item:hover .nav-ic,
.admin-nav-item.active .nav-ic { color: currentColor; }
.admin-nav-item:hover {
  background: var(--admin-nav-hover-bg);
  color: var(--admin-nav-hover-text);
}
.admin-nav-item.active {
  background: var(--admin-nav-active-bg);
  color: var(--admin-nav-active-text);
  box-shadow: inset 5px 0 0 var(--admin-nav-active-marker);
  font-weight: 700;
}
.admin-nav-item:focus-visible,
.admin-nav-child-link:focus-visible {
  outline: 3px solid var(--admin-nav-text);
  outline-offset: 2px;
}
.admin-nav-item.active::before { display: none; }
.admin-nav-item[aria-controls$="Children"]::after {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: '';
  opacity: 0.78;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--dur) var(--ease);
}
.admin-nav-item[aria-controls$="Children"] { padding-inline-end: 16px; }
.admin-nav-item[aria-controls$="Children"][aria-expanded="true"]::after {
  transform: rotate(225deg) translate(-2px, -1px);
}

body.admin-shell-nav-compact .admin-nav {
  padding: 0;
}
/* Session and scope-switching controls need their labels and identity context.
 * Keep them out of the icon-only rail; they return with the shared open state
 * used by hover, keyboard reveal and pinning. */
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-footer {
  display: none;
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-children:not(.admin-nav-children--animated),
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-setup-widget {
  display: none;
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-children--animated {
  grid-template-rows: 0fr;
  margin-block: 0;
  border-left-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition-delay: 0s, 0s, 0s, 0s, 0s, var(--dur-slow);
  visibility: hidden;
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-label {
  max-height: 0;
  padding-block: 0;
  opacity: 0;
  transform: translateX(-6px);
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-item {
  gap: 0;
  width: 60px;
  padding: 10px 20px;
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-item__label {
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-item .count-badge {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-item .dirty-dot {
  position: absolute;
  right: 5px;
  bottom: 4px;
  margin: 0;
  box-shadow: 0 0 0 2px var(--admin-nav-bg);
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-item[aria-controls$="Children"]::after {
  display: none;
}
body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-item.admin-nav-item--locked::after {
  position: absolute;
  top: 2px;
  right: 2px;
  width: auto;
  margin: 0;
  content: '\1f512';
  font-size: 10px;
  letter-spacing: normal;
}

/* Desktop rails own their controls above the full-bleed fixed header. */
@media (min-width: 721px) {
  /* A definite open width at every desktop size. Collapsing at the 900px
   * breakpoint also drops the wide-screen open rule below, and a rail left at
   * its automatic width snaps to the icon rail instead of animating to it. */
  .admin-nav { z-index: 60; width: var(--admin-nav-w); }

  body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav {
    width: var(--admin-nav-compact-w);
  }

  /* Keep the compact rail's narrow chrome quiet without turning its route
   * inventory into a clipped region. Wheel, touchpad and focus scrolling keep
   * the full route list reachable on constrained-height desktops. */
  body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  body.admin-shell-nav-compact:not(.admin-shell-nav-open) .admin-nav-content::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  /* Pinning an already revealed rail keeps its existing geometry while the
   * workspace reserve catches up. */
  body.admin-shell-nav-pinning .admin-nav { transition: none; }
}

/* Hover, keyboard reveal and the pinned state share one visual-open contract.
 * Compact preference only controls workspace reservation and the toggle
 * direction; it cannot give the rail a second, subtly different open layout. */
@media (min-width: 901px) {
  body.admin-shell-nav-open .admin-nav {
    width: var(--admin-nav-w);
  }

  /* A temporary hover/keyboard reveal gently recedes the workspace without
   * changing its layout or painted bounds. Pinning restores it immediately. */
  body.admin-shell-nav-compact.admin-shell-nav-open:not(.admin-shell-nav-pinning) .admin-page::after {
    opacity: 1;
    transition-delay: 0s, 0s;
    visibility: visible;
  }
}

.admin-nav-item.admin-nav-item--locked {
  color: var(--admin-nav-locked-text);
  cursor: not-allowed;
}
.admin-nav-item.admin-nav-item--locked:hover,
.admin-nav-item.admin-nav-item--locked.active {
  background: transparent;
  box-shadow: none;
  color: var(--admin-nav-locked-text);
}
.admin-nav-item.admin-nav-item--locked::after {
  content: 'Locked';
  margin-left: auto;
  color: var(--admin-nav-locked-label-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-nav-item .count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--card);
  font-size: 10px;
  font-weight: 700;
}

.admin-nav-item .dirty-dot {
  display: none;
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--highlight);
}
.admin-nav-item.is-dirty .dirty-dot { display: inline-block; }

.admin-nav-children[hidden] { display: none; }
.admin-nav-children {
  margin: var(--space-3xs) var(--space-sm) var(--space-xs) var(--space-2xl);
  padding-left: var(--space-2xs);
  border-left: 1px solid rgba(var(--admin-nav-text-rgb), 0.22);
}
.admin-nav-children--animated {
  display: grid;
  overflow: hidden;
  grid-template-rows: 0fr;
  margin-block: 0;
  border-left-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transform-origin: top;
  transition:
    grid-template-rows var(--dur-slow) var(--ease-emphasized),
    margin-block var(--dur-slow) var(--ease-emphasized),
    border-color var(--dur) var(--ease),
    opacity var(--dur) var(--ease),
    transform var(--dur-slow) var(--ease-emphasized),
    visibility 0s linear var(--dur-slow);
  visibility: hidden;
}
.admin-nav-children--animated.is-expanded {
  grid-template-rows: 1fr;
  margin-block: var(--space-3xs) var(--space-xs);
  border-left-color: rgba(var(--admin-nav-text-rgb), 0.22);
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
  visibility: visible;
}
.admin-nav-children__inner {
  overflow: hidden;
  min-height: 0;
}
.admin-nav-child-group + .admin-nav-child-group { margin-top: 2px; }
.admin-nav-child-link {
  display: block;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: 4px;
  color: var(--admin-nav-child-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}
.admin-nav-child-link--with-icon {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.admin-nav-child-icon {
  color: var(--admin-nav-child-text);
  --icon-size: 15px;
}
.admin-nav-child-link--with-icon:hover .admin-nav-child-icon,
.admin-nav-child-link--with-icon.active .admin-nav-child-icon,
.admin-nav-child-link--with-icon.is-ancestor .admin-nav-child-icon { color: currentColor; }
.admin-nav-child-link:hover {
  background: var(--admin-nav-hover-bg);
  color: var(--admin-nav-hover-text);
}
.admin-nav-child-link.active {
  background: var(--admin-nav-active-bg);
  color: var(--admin-nav-child-active-text);
}
.admin-nav-child-link.is-ancestor {
  color: var(--admin-nav-ancestor-text);
}
.admin-nav-children .admin-nav-item--nested {
  min-height: 34px;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: 4px;
  color: var(--admin-nav-child-text);
  font-size: 12px;
  line-height: 1.35;
  box-shadow: none;
}
.admin-nav-children .admin-nav-item--nested .nav-ic {
  width: 15px;
  height: 15px;
  color: currentColor;
}
.admin-nav-children .admin-nav-item--nested.active {
  color: var(--admin-nav-child-active-text);
  box-shadow: none;
}

/* ── Content canvas ───────────────────────────────────────────── */
.admin-main {
  min-width: 0;
  width: 100%;
  padding: var(--space-3xl) var(--space-4xl) var(--space-4xl);
  transition: padding var(--dur-slow) var(--ease-emphasized), opacity var(--dur) ease;
}
.admin-main .panel {
  display: none;
  padding: var(--admin-panel-padding, 36px 44px);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  animation: fadeIn var(--dur) ease;
}
.admin-main .panel.active { display: block; }

/* ── Shared topbar account controls ───────────────────────────── */
.btn-google-signin {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-2xl);
  border: 1px solid var(--admin-header-text);
  border-radius: var(--radius-btn, 8px);
  background: var(--admin-header-text);
  color: var(--admin-header-bg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
}
.btn-google-signin:hover {
  background: var(--admin-header-control-hover);
  border-color: var(--admin-header-control-hover);
}
.oauth-user-email {
  color: rgba(var(--admin-header-text-rgb), 0.7);
  font-size: 13px;
}
.btn-signout {
  padding: var(--space-xs) var(--space-lg);
  border: 1px solid rgba(var(--admin-header-text-rgb), 0.2);
  border-radius: var(--radius-btn, 8px);
  background: transparent;
  color: rgba(var(--admin-header-text-rgb), 0.7);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.btn-signout:hover {
  background: rgba(var(--admin-header-text-rgb), 0.1);
  color: var(--admin-header-text);
}
.btn-super-admin {
  padding: var(--space-xs) var(--space-lg);
  border: 1px solid var(--admin-header-text);
  border-radius: var(--radius-btn, 8px);
  background: var(--admin-header-text);
  color: var(--admin-header-bg);
  font-size: 12px;
  font-weight: 600;
  line-height: normal;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn-super-admin:hover {
  background: var(--admin-header-control-hover);
  border-color: var(--admin-header-control-hover);
  color: var(--admin-header-bg);
}
.btn-super-admin:focus-visible {
  outline: 3px solid rgba(var(--admin-header-text-rgb), 0.72);
  outline-offset: 2px;
}
#oauthLoginWrap,
#oauthUserWrap {
  display: flex;
  align-items: center;
}
#oauthUserWrap { gap: var(--space-sm); }

.admin-identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.admin-identity .oauth-user-email { line-height: 1.2; }
/* The initial hand-off is deliberately brisk; normal navigation motion keeps
 * the shared duration tokens once this short-lived class is removed. */
body.admin-shell-revealing .admin-hero,
body.admin-shell-revealing .admin-body {
  transition-duration: min(100ms, var(--dur));
}

.admin-site-switcher {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: rgba(var(--admin-header-text-rgb), 0.72);
  font-size: 12px;
  white-space: nowrap;
}
.admin-site-switcher__label { font-weight: 600; }
.admin-site-switcher select {
  max-width: min(300px, 28vw);
  min-width: 170px;
  padding: var(--space-xs) var(--space-2xl) var(--space-xs) var(--space-sm);
  border: 1px solid rgba(var(--admin-header-text-rgb), 0.32);
  border-radius: var(--radius-btn, 8px);
  background: rgba(255, 255, 255, 0.08);
  color: var(--admin-header-text);
  font: inherit;
}
.admin-site-switcher select:focus-visible {
  outline: 2px solid var(--admin-header-accent);
  outline-offset: 2px;
}
.admin-site-switcher option { color: var(--golfkit-primary, #0f172a); }
/* A closed venue is listed but cannot be chosen: show it muted, not like an open one. */
.admin-site-switcher option:disabled { color: var(--text-muted); }

/* ── Responsive shell hand-off ───────────────────────────────── */
@media (max-width: 720px) {
  .admin-header-inner {
    padding-inline: var(--space-2xl);
    padding-inline-start: var(--space-2xl);
  }

  /* Phones use the drawer. Constrained desktops keep the compact rail, which
   * remains discoverable through hover and keyboard focus. */
  body.admin-shell-auth-prompt .admin-nav-toggle { display: none; }
  .admin-nav-toggle {
    display: inline-flex;
    margin-inline-start: 0;
  }
  .admin-nav-collapse-toggle,
  .admin-nav-shell-header { display: none; }
  /* The drawer carries the GolfKit wordmark at this breakpoint, leaving the
   * fixed header focused on the menu trigger and current route. */
  .admin-header-wordmark { display: none; }
  .admin-header-sub,
  .admin-header-divider { display: none; }
  .admin-route-context {
    max-width: min(260px, 30vw);
    margin-inline-start: var(--space-lg);
  }
  .admin-site-switcher__label { display: none; }
  .admin-site-switcher select { min-width: 0; max-width: 42vw; }

  .admin-body,
  body.admin-shell-nav-compact .admin-body {
    --admin-shell-rail-reserve: 0px;
    grid-template-columns: 0 minmax(0, 1fr);
  }

  @media (max-width: 720px) {
  .admin-body,
  body.admin-shell-nav-compact .admin-body { grid-template-columns: 0 minmax(0, 1fr); }
  .admin-main { padding: var(--space-lg); }
  }

  .admin-nav-drawer {
    --gk-drawer-w: min(300px, calc(100vw - 48px));
    --gk-drawer-radius: 0px;
  }
  #adminNavDrawer {
    /* The drawer is the same navigation destination as the desktop rail. */
    --gk-drawer-surface: var(--admin-nav-bg);
    --gk-drawer-bg: var(--admin-nav-bg);
    --gk-drawer-text: var(--admin-nav-text);
    --gk-drawer-muted-text: var(--admin-nav-label-text);
    --gk-drawer-border: rgba(var(--admin-nav-text-rgb), 0.16);
    --gk-drawer-hover: var(--admin-nav-hover-bg);
    --admin-drawer-active-bg: var(--admin-nav-active-bg);
    --admin-drawer-active-text: var(--admin-nav-active-text);
    --admin-drawer-child-active-bg: var(--admin-nav-active-bg);
    --admin-drawer-child-active-text: var(--admin-nav-child-active-text);
  }
  #adminBody > .admin-nav {
    width: var(--admin-nav-compact-w);
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
    transition:
      padding var(--dur-slow) ease,
      opacity var(--dur-slow) var(--ease-emphasized),
      transform var(--dur-slow) var(--ease-emphasized),
      visibility 0s linear var(--dur-slow);
    visibility: hidden;
  }
  #adminNavDrawer .admin-nav-footer {
    margin-top: var(--space-md);
    padding: var(--space-lg) var(--space-lg) var(--space-2xs);
    border-top-color: var(--gk-drawer-border);
    background: transparent;
  }
  #adminNavDrawer .admin-nav-account {
    flex-direction: column;
    align-items: stretch;
  }
  #adminNavDrawer .admin-nav-account-tooltip {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
  }
  #adminNavDrawer .admin-nav-account .admin-nav-account-action--icon {
    display: inline-flex;
    width: 100%;
    min-height: 44px;
    height: auto;
    padding: var(--space-sm) var(--space-lg);
    justify-content: center;
    gap: var(--space-sm);
    font-size: inherit;
  }
  #adminNavDrawer .oauth-user-email {
    display: block;
    overflow: hidden;
    max-width: 100%;
    margin-right: 0;
    color: var(--gk-drawer-muted-text);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #adminNavDrawer .admin-identity { align-items: flex-start; }
  #adminNavDrawer .btn-signout {
    border-color: var(--gk-drawer-border);
    color: var(--gk-drawer-text);
    text-align: center;
  }
  #adminNavDrawer .btn-signout:hover {
    background: var(--gk-drawer-hover);
    color: var(--gk-drawer-text);
  }
  #adminNavDrawer .btn-super-admin {
    border-color: var(--gk-drawer-text);
    background: var(--gk-drawer-text);
    color: var(--gk-drawer-surface);
    text-align: center;
  }
  #adminNavDrawer .btn-super-admin:hover {
    background: var(--gk-drawer-hover);
    border-color: var(--gk-drawer-hover);
    color: var(--gk-drawer-text);
  }
  #adminNavDrawer .admin-nav {
    display: flex;
    min-height: 100%;
    padding: 0;
  }
  #adminNavDrawer .admin-nav-brand { border-bottom-color: var(--gk-drawer-border); }
  #adminNavDrawer .admin-nav-brand__label { color: var(--gk-drawer-muted-text); }
  #adminNavDrawer .admin-nav-brand__name { color: var(--gk-drawer-text); }
  #adminNavDrawer .admin-nav-label { color: var(--gk-drawer-muted-text); }
  #adminNavDrawer .admin-nav-item,
  #adminNavDrawer .admin-nav-child-link { color: var(--gk-drawer-text); }
  #adminNavDrawer .admin-nav-item .nav-ic { color: var(--gk-drawer-muted-text); }
  #adminNavDrawer .admin-nav-item.active .nav-ic { color: currentColor; }
  #adminNavDrawer .admin-nav-item.admin-nav-item--locked::after {
    color: var(--gk-drawer-muted-text);
  }
  #adminNavDrawer .admin-nav-item:hover,
  #adminNavDrawer .admin-nav-child-link:hover {
    background: var(--gk-drawer-hover);
    color: var(--gk-drawer-text);
  }
  /* The same sidebar is relocated here on narrow viewports, so preserve its
   * selection hierarchy instead of promoting the current route to a solid
   * brand-colour button. */
  #adminNavDrawer .admin-nav-item.active {
    background: var(--admin-drawer-active-bg);
    color: var(--admin-drawer-active-text);
  }
  #adminNavDrawer .admin-nav-child-link.active {
    background: var(--admin-drawer-child-active-bg);
    color: var(--admin-drawer-child-active-text);
  }
  #adminNavDrawer .admin-nav-children .admin-nav-item--nested.active {
    background: var(--admin-drawer-child-active-bg);
    color: var(--admin-drawer-child-active-text);
  }
  @media (max-width: 720px) {
    .admin-main .panel { padding: var(--space-4xl) var(--space-3xl); }
  }
}

@media (max-width: 720px) {
  .admin-main { padding: 0; }
  .admin-main .panel {
    padding: var(--space-2xl) var(--space-xl);
    background: var(--card);
  }
  .admin-main gk-collapse { border-radius: 0; }
}

@media (max-width: 720px) {
  .admin-header-inner {
    padding-inline: var(--space-2xl);
    gap: var(--space-xs);
  }
  .admin-wordmark { font-size: 18px; }
  .admin-nav-toggle {
    width: 44px;
    height: 44px;
    margin-inline-end: var(--space-sm);
  }
  .admin-route-context {
    max-width: none;
    margin-inline-start: var(--space-lg);
    padding-inline-start: var(--space-sm);
    flex: 1 1 auto;
  }
  .admin-route-context__icon { display: none; }
  .admin-route-context__scope { font-size: 9px; }
  .admin-route-context__label { font-size: 12px; }
  .admin-site-switcher select { max-width: 34vw; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-hero,
  .admin-body,
  .admin-workspace,
  .admin-page::after,
  .admin-main,
  .admin-nav,
  .admin-nav-children--animated,
  .admin-nav-label,
  .admin-nav-item__label,
  .admin-nav-item[aria-controls$="Children"]::after,
  .admin-nav-collapse-toggle,
  .admin-nav-toggle__line { transition: none !important; }
}
