@import url("/static/shared/site-topbar.css?v=20261007btn2");
@import url("/static/shared/nav.css?v=20261006appbar2");
@import url("/static/shared/buttons.css?v=20261008teaserbtn");

.app-shell {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 100vh;
  overflow-x: clip;
}

.app-sidebar {
  flex: 0 0 220px;
  width: 220px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1.25rem 0.75rem 1.5rem;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  color: var(--text);
  text-decoration: none;
}

.app-sidebar-brand:hover {
  opacity: 0.92;
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-sidebar-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

/* Author `display` above would otherwise override the HTML `hidden` attribute. */
.app-sidebar-nav a.hidden,
.app-sidebar-nav a[hidden] {
  display: none;
}

.app-sidebar-link-inner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.app-sidebar-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--muted);
}

.app-sidebar-icon svg {
  display: block;
}

.app-sidebar-nav a:hover .app-sidebar-icon,
.app-sidebar-nav a.active .app-sidebar-icon {
  color: var(--accent);
}

.app-sidebar-nav a:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.app-sidebar-nav a.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-weight: 600;
}

.app-sidebar-nav a.is-locked {
  color: var(--muted);
}

.app-sidebar-nav a.is-locked:hover {
  background: color-mix(in srgb, var(--muted) 10%, transparent);
}

.app-sidebar-nav a.is-locked .app-sidebar-icon {
  color: var(--muted);
}

.app-sidebar-lock {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.85;
}

.app-sidebar-nav a.is-locked:hover .app-sidebar-lock {
  color: var(--text);
  opacity: 1;
}

/* Neutral entitlement pending (no false Starter lock / no unlocked flash). */
.app-sidebar-nav a.is-entitlement-pending {
  opacity: 0.55;
  pointer-events: none;
}

.app-sidebar-nav a.is-entitlement-pending .app-sidebar-lock {
  display: none;
}

/* Content gates: soft dim until shell is optimistic or ready. */
html[data-shell="pending"] [data-entitlement-gate],
html:not([data-shell]) [data-entitlement-gate] {
  pointer-events: none;
  opacity: 0.55;
}

/* Optional blocks that appear after entitlements: reserve a skeleton slot. */
html[data-shell="pending"] [data-entitlement-gate].entitlement-gate--slot,
html:not([data-shell]) [data-entitlement-gate].entitlement-gate--slot {
  display: block;
  visibility: visible;
  position: relative;
  min-height: 1.35rem;
  color: transparent;
  user-select: none;
  opacity: 1;
}

html[data-shell="pending"] details[data-entitlement-gate].entitlement-gate--slot,
html:not([data-shell]) details[data-entitlement-gate].entitlement-gate--slot {
  display: block;
}

html[data-shell="pending"] [data-entitlement-gate].entitlement-gate--slot::before,
html:not([data-shell]) [data-entitlement-gate].entitlement-gate--slot::before {
  content: "";
  position: absolute;
  inset: 0.15rem 0;
  max-width: 22rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

html[data-shell="optimistic"] [data-entitlement-gate],
html[data-shell="ready"] [data-entitlement-gate] {
  pointer-events: auto;
  opacity: 1;
  color: inherit;
}

html[data-shell="optimistic"] [data-entitlement-gate].entitlement-gate--slot::before,
html[data-shell="ready"] [data-entitlement-gate].entitlement-gate--slot::before {
  content: none;
}

/* Hide slot skeletons once JS has decided the block stays .hidden */
html[data-shell="optimistic"] [data-entitlement-gate].hidden,
html[data-shell="ready"] [data-entitlement-gate].hidden {
  display: none;
}

.app-upgrade-dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  max-width: 26rem;
  width: calc(100% - 2rem);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--text) 18%, transparent);
}

.app-upgrade-dialog::backdrop {
  background: color-mix(in srgb, var(--text) 35%, transparent);
}

.app-upgrade-dialog-body {
  display: grid;
  gap: 0.85rem;
  padding: 1.25rem 1.35rem 1.35rem;
}

.app-upgrade-dialog-body h2 {
  margin: 0;
  font-size: 1.15rem;
}

.app-upgrade-dialog-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.app-upgrade-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.app-upgrade-dialog-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.app-sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
  flex-shrink: 0;
}

.app-sidebar-divider.hidden {
  display: none;
}

.app-shell-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  overflow-x: clip;
}

.app-shell-body {
  flex: 1 1 auto;
  min-width: 0;
}

.app-shell-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 1.5rem 1.25rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-shell-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.875rem;
}

.app-shell-footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.app-shell-footer-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

.app-shell-footer-copy {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Frosted like the public bar. Controls stay in a centered column. */
header#app-nav.app-nav {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom-color: color-mix(in srgb, var(--border) 70%, transparent);
}

.app-shell-main .app-nav-inner {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  justify-content: space-between;
}

.loading-hint,
.page-content-loading,
.org-summary-name.is-loading,
.is-loading {
  color: var(--muted);
}

.page-content-loading {
  margin: 0.75rem 0 1rem;
  font-size: 0.95rem;
}

.page-content-loading.hidden {
  display: none;
}

.account-hub-grid-skeleton {
  display: grid;
  gap: 0.75rem;
}

.account-hub-grid.hidden,
.account-hub-grid-skeleton.hidden {
  display: none;
}

.account-hub-link-skeleton {
  min-height: 4.25rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: linear-gradient(
    110deg,
    color-mix(in srgb, var(--surface) 90%, var(--bg)) 25%,
    color-mix(in srgb, var(--muted) 10%, var(--surface)) 42%,
    color-mix(in srgb, var(--surface) 90%, var(--bg)) 58%
  );
  background-size: 200% 100%;
  animation: page-skeleton-shimmer 1.2s ease-in-out infinite;
}

.account-profile-skeleton-line {
  display: block;
  height: 0.95rem;
  border-radius: 6px;
  margin: 0.35rem 0;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

.account-profile-skeleton-line--name {
  width: 9rem;
}

.account-profile-skeleton-line--email {
  width: 14rem;
}

.account-profile-skeleton-line--badge {
  width: 4.5rem;
  height: 1.4rem;
  border-radius: 999px;
}

@keyframes page-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-hub-link-skeleton {
    animation: none;
  }
}

.account-hub-grid.is-loading,
.keys-table tbody.is-loading {
  min-height: 4.5rem;
}

.app-nav-actions .app-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.app-nav-actions .app-nav-link:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  text-decoration: none;
}

.app-nav-actions .app-nav-link.active {
  color: var(--text);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
    min-height: 0;
  }

  .app-sidebar {
    flex: none;
    width: 100%;
    height: auto;
    max-height: none;
    position: sticky;
    top: 0;
    z-index: 100;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
  }

  .app-sidebar-brand {
    margin-bottom: 0.5rem;
    width: auto;
  }

  .app-sidebar-brand .brand-logo--sidebar {
    height: 1.2rem;
  }

  .app-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .app-sidebar-divider {
    display: none;
  }

  .app-shell-main {
    min-height: 0;
  }
}
