/* Shared SaaS workbench shell for the user and admin surfaces. */
:root {
  --saas-shell-sidebar: 208px;
  --saas-shell-topbar: 64px;
  --saas-shell-line: rgba(16, 24, 40, 0.1);
  --saas-shell-ink: #101828;
  --saas-shell-text: #344054;
  --saas-shell-muted: #667085;
  --saas-shell-blue: #2563eb;
  --saas-shell-blue-soft: #eff6ff;
  --saas-shell-canvas: #f6f8fb;
}

body:not([data-surface="admin"]) {
  background: var(--saas-shell-canvas) !important;
}

body:not([data-surface="admin"]) .app-topbar {
  min-height: var(--saas-shell-topbar);
  padding: 0 22px;
  border-bottom: 1px solid var(--saas-shell-line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
  backdrop-filter: blur(16px);
}

body:not([data-surface="admin"]) .app-main {
  margin-left: var(--saas-shell-sidebar);
  min-height: 100vh;
  padding: calc(var(--saas-shell-topbar) + 24px) 24px 28px;
}

body:not([data-surface="admin"]) .page-shell {
  max-width: 1560px;
  margin: 0 auto;
}

body:not([data-surface="admin"]) .app-sidebar {
  top: var(--saas-shell-topbar);
  width: var(--saas-shell-sidebar);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px 10px;
  border-right: 1px solid var(--saas-shell-line);
  background: #fff;
}

body:not([data-surface="admin"]) .app-sidebar-section-label {
  padding: 10px 10px 5px;
  color: #98a2b3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

body:not([data-surface="admin"]) .app-sidebar-section-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--saas-shell-blue);
  font-size: 16px;
}

body:not([data-surface="admin"]) .sidebar-generation {
  gap: 5px;
  padding: 5px 0 10px;
}

body:not([data-surface="admin"]) .sidebar-generation-head {
  min-height: 36px;
  padding: 0 10px;
  color: var(--saas-shell-text);
}

body:not([data-surface="admin"]) .sidebar-generation-title {
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.02em;
}

body:not([data-surface="admin"]) .sidebar-generation-chevron {
  color: #98a2b3;
  font-size: 14px;
  transition: transform 0.18s ease;
}

body:not([data-surface="admin"]) .sidebar-generation[open] .sidebar-generation-chevron {
  transform: rotate(180deg);
}

body:not([data-surface="admin"]) .app-sidebar-account-label {
  margin-top: 4px;
}

body:not([data-surface="admin"]) .app-sidebar-account-nav {
  display: grid;
}

body:not([data-surface="admin"]) .app-sidebar-link {
  min-height: 38px;
  padding-right: 8px;
  padding-left: 8px;
  border-radius: 8px;
  color: var(--saas-shell-text);
  font-size: 12px;
  font-weight: 700;
}

body:not([data-surface="admin"]) .app-sidebar-link:hover {
  border-color: rgba(37, 99, 235, 0.12);
  background: #f8fbff;
  color: var(--saas-shell-ink);
}

body:not([data-surface="admin"]) .app-sidebar-link.is-active {
  border-color: rgba(37, 99, 235, 0.18);
  background: var(--saas-shell-blue-soft);
  color: var(--saas-shell-blue);
  box-shadow: inset 3px 0 0 var(--saas-shell-blue);
}

body:not([data-surface="admin"]) .app-sidebar-footer {
  margin-top: auto;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--saas-shell-line);
}

body:not([data-surface="admin"]) .sidebar-credit {
  justify-content: flex-start;
  min-height: 34px;
  border: 0;
  background: #f0fdfa;
  color: #0f766e;
}

.saas-shell-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px 0 8px;
  background: var(--saas-shell-line);
}

.saas-shell-context {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.saas-shell-context span,
.admin-page-context span {
  color: var(--saas-shell-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.saas-shell-context strong,
.admin-page-context strong {
  overflow: hidden;
  color: var(--saas-shell-ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saas-shell-workspace {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--saas-shell-line);
  border-radius: 8px;
  background: #fff;
}

.saas-shell-workspace > span:last-child {
  display: grid;
  gap: 1px;
}

.saas-shell-workspace small {
  color: var(--saas-shell-muted);
  font-size: 9px;
  line-height: 1.1;
}

.saas-shell-workspace strong {
  color: var(--saas-shell-ink);
  font-size: 11px;
  line-height: 1.2;
}

.saas-shell-workspace-mark,
.saas-shell-avatar {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 7px;
  color: var(--saas-shell-blue);
  background: var(--saas-shell-blue-soft);
  font-size: 14px;
}

.saas-shell-upgrade,
.saas-shell-user-link,
.saas-shell-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid var(--saas-shell-line);
  border-radius: 8px;
  color: var(--saas-shell-text);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.saas-shell-upgrade {
  padding: 0 11px;
  border-color: rgba(37, 99, 235, 0.18);
  color: var(--saas-shell-blue);
  background: var(--saas-shell-blue-soft);
}

.saas-shell-user-link {
  padding: 0 8px 0 5px;
}

.saas-shell-icon-button {
  width: 36px;
  padding: 0;
  cursor: pointer;
}

.saas-shell-upgrade:hover,
.saas-shell-user-link:hover,
.saas-shell-icon-button:hover {
  border-color: rgba(37, 99, 235, 0.28);
  color: var(--saas-shell-blue);
  background: #f8fbff;
}

body[data-surface="admin"] .admin-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--saas-shell-ink);
  text-decoration: none;
}

body[data-surface="admin"] .admin-topbar-brand .brand-mark {
  width: 28px;
  height: 28px;
}

body[data-surface="admin"] .admin-topbar-brand .brand-wordmark {
  font-size: 15px;
}

body[data-surface="admin"] .admin-page-context {
  display: grid;
  gap: 2px;
}

body[data-surface="admin"] .admin-user-badge {
  gap: 7px;
  min-height: 36px;
  padding: 0 9px 0 5px;
  border-radius: 8px;
}

body[data-surface="admin"] .admin-user-badge .saas-shell-avatar {
  width: 26px;
  height: 26px;
}

@media (max-width: 1100px) {
  .saas-shell-workspace {
    display: none;
  }

  .saas-shell-user-label {
    display: none;
  }
}

@media (max-width: 991.98px) {
  body:not([data-surface="admin"]) .app-main {
    margin-left: 0;
    padding: 78px 16px 24px;
  }

  body:not([data-surface="admin"]) .app-sidebar {
    top: 10px;
  }

  body[data-surface="admin"] .admin-topbar-brand,
  body[data-surface="admin"] .saas-shell-divider,
  body[data-surface="admin"] .saas-shell-upgrade {
    display: none;
  }
}

@media (max-width: 768px) {
  body:not([data-surface="admin"]) .app-topbar {
    padding: 0 12px;
  }

  body:not([data-surface="admin"]) .saas-shell-divider,
  body:not([data-surface="admin"]) .saas-shell-context,
  body:not([data-surface="admin"]) .saas-shell-upgrade,
  body:not([data-surface="admin"]) .app-topbar-chip,
  body:not([data-surface="admin"]) .saas-shell-user-link {
    display: none;
  }

  body:not([data-surface="admin"]) .app-sidebar-account-label {
    display: block;
  }

  body[data-surface="admin"] .app-topbar-right .saas-shell-workspace,
  body[data-surface="admin"] .app-topbar-right .saas-shell-upgrade {
    display: none;
  }
}
