:root {
  --sf-shell-rail: 208px;
  --sf-shell-top: 64px;
  --sf-shell-green: #126b4e;
  --sf-shell-green-dark: #0d543e;
  --sf-shell-ink: #17211d;
  --sf-shell-muted: #62706a;
  --sf-shell-line: #d8e1db;
  --sf-shell-paper: #ffffff;
  --sf-shell-soft: #f2f6f3;
}

body.sf-unified-page {
  padding-left: var(--sf-shell-rail);
  padding-top: var(--sf-shell-top);
}

body.sf-unified-page .community-header {
  border: 0 !important;
  height: 1px !important;
  left: -2px !important;
  min-height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  top: -2px !important;
  width: 1px !important;
  z-index: -1 !important;
}

body.sf-unified-page .community-footer {
  margin-left: 0;
}

html[data-sf-navigating="true"]::before {
  animation: sf-navigation-progress 1.1s ease-in-out infinite;
  background: var(--sf-shell-green);
  content: "";
  height: 3px;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  transform-origin: left center;
  z-index: 200;
}

@keyframes sf-navigation-progress {
  0% { opacity: .65; transform: scaleX(.08); }
  55% { opacity: 1; transform: scaleX(.72); }
  100% { opacity: .75; transform: scaleX(.96); }
}

@media (prefers-reduced-motion: reduce) {
  html[data-sf-navigating="true"]::before { animation: none; transform: scaleX(.55); }
}

.sf-app-shell,
.sf-app-shell * {
  box-sizing: border-box;
}

.sf-app-shell {
  color: var(--sf-shell-ink);
  font-family: "Noto Sans JP", system-ui, sans-serif;
}

.sf-shell-rail {
  background: #f8fbf9;
  border-right: 1px solid var(--sf-shell-line);
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  left: 0;
  padding: 16px 14px;
  position: fixed;
  top: 0;
  width: var(--sf-shell-rail);
  z-index: 80;
}

.sf-shell-brand {
  align-items: center;
  color: var(--sf-shell-ink);
  display: flex;
  gap: 10px;
  min-height: 36px;
  text-decoration: none;
}

.sf-shell-brand-mark {
  align-items: center;
  background: var(--sf-shell-green);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  letter-spacing: 0;
  width: 34px;
}

.sf-shell-brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.25;
}

.sf-shell-brand-copy strong {
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

.sf-shell-brand-copy small {
  color: var(--sf-shell-muted);
  font-size: 10px;
}

.sf-shell-nav {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
}

.sf-shell-nav-group {
  display: grid;
  gap: 3px;
  margin-top: 8px;
}

.sf-shell-nav-group:first-child {
  margin-top: 0;
}

.sf-shell-nav-label {
  color: var(--sf-shell-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 0 10px 4px;
}

.sf-shell-nav a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--sf-shell-muted);
  display: flex;
  font-size: 13px;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  text-decoration: none;
}

.sf-shell-location,
.sf-shell-topbar-actions,
.sf-shell-search,
.sf-shell-search input,
.sf-shell-account-copy {
  min-width: 0;
}

.sf-shell-location strong,
.sf-shell-location small,
.sf-shell-account-copy a,
.sf-shell-account-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-shell-nav a:hover,
.sf-shell-nav a:focus-visible,
.sf-shell-nav a.is-active {
  background: var(--sf-shell-soft);
  border-color: var(--sf-shell-line);
  color: var(--sf-shell-green-dark);
  outline: 0;
}

.sf-shell-nav a.is-active {
  font-weight: 800;
}

.sf-shell-nav-icon {
  align-items: center;
  color: currentColor;
  display: inline-flex;
  flex: 0 0 20px;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.sf-shell-nav-icon svg,
.sf-shell-topbar svg,
.sf-shell-mobile-nav svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 18px;
}

.sf-shell-context {
  border-top: 1px solid var(--sf-shell-line);
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding-top: 14px;
}

.sf-shell-context-label {
  color: var(--sf-shell-muted);
  font-size: 10px;
  font-weight: 700;
}

.sf-shell-context select {
  background: var(--sf-shell-paper);
  border: 1px solid var(--sf-shell-line);
  border-radius: 6px;
  color: var(--sf-shell-ink);
  font-size: 12px;
  min-height: 36px;
  padding: 5px 8px;
  width: 100%;
}

.sf-shell-context-directory {
  align-content: start;
  gap: 5px;
}

.sf-shell-context-directory span {
  color: var(--sf-shell-muted);
  font-size: 10px;
  font-weight: 700;
}

.sf-shell-context-directory strong {
  color: var(--sf-shell-ink);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-shell-context-directory small {
  color: var(--sf-shell-muted);
  font-size: 11px;
}

.sf-shell-context-directory a {
  color: var(--sf-shell-green-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.sf-shell-context-directory a:hover,
.sf-shell-context-directory a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sf-shell-account {
  align-items: center;
  border-top: 1px solid var(--sf-shell-line);
  display: flex;
  gap: 8px;
  padding-top: 12px;
}

.sf-shell-account-avatar {
  align-items: center;
  background: #e3f0e8;
  border-radius: 50%;
  color: var(--sf-shell-green-dark);
  display: inline-flex;
  flex: 0 0 30px;
  font-size: 12px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.sf-shell-account-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sf-shell-account-copy a,
.sf-shell-account-copy span {
  color: var(--sf-shell-ink);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

.sf-shell-account-copy small {
  color: var(--sf-shell-muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-shell-auth-pending {
  color: var(--sf-shell-muted) !important;
  font-size: 11px !important;
  font-weight: 700;
  white-space: nowrap;
}

.sf-shell-account-action {
  color: var(--sf-shell-green-dark) !important;
  font-size: 11px !important;
  font-weight: 700;
  text-decoration: none;
}

.sf-shell-account-action:hover,
.sf-shell-account-action:focus-visible {
  text-decoration: underline;
}

.sf-shell-topbar {
  align-items: center;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--sf-shell-line);
  display: flex;
  gap: 18px;
  height: var(--sf-shell-top);
  justify-content: space-between;
  left: var(--sf-shell-rail);
  padding: 10px clamp(18px, 3vw, 42px);
  position: fixed;
  right: 0;
  top: 0;
  z-index: 75;
}

.sf-shell-mobile-account {
  align-items: center;
  border: 1px solid var(--sf-shell-line);
  border-radius: 999px;
  color: var(--sf-shell-ink);
  display: none;
  font-size: 11px;
  gap: 6px;
  max-width: 42vw;
  min-height: 32px;
  overflow: hidden;
  padding: 0 9px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-shell-mobile-account > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-shell-mobile-account-dot {
  background: var(--sf-shell-green);
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 7px;
  height: 7px;
  width: 7px;
}

.sf-shell-mobile-account-pending {
  color: var(--sf-shell-muted);
}

.sf-shell-mobile-account-signin {
  background: var(--sf-shell-green);
  border-color: var(--sf-shell-green);
  color: #fff;
  font-weight: 800;
}

.sf-shell-location {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.sf-shell-location strong {
  font-size: 15px;
  line-height: 1.3;
}

.sf-shell-location small {
  color: var(--sf-shell-muted);
  font-size: 10px;
}

.sf-shell-topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.sf-shell-search {
  align-items: center;
  background: #f7faf8;
  border: 1px solid var(--sf-shell-line);
  border-radius: 7px;
  display: flex;
  gap: 7px;
  min-width: min(30vw, 320px);
  padding: 0 10px;
}

.sf-shell-search input {
  background: transparent;
  border: 0;
  color: var(--sf-shell-ink);
  font-size: 12px;
  min-height: 36px;
  outline: 0;
  width: 100%;
}

.sf-shell-user-link,
.sf-shell-signin {
  align-items: center;
  border: 1px solid var(--sf-shell-line);
  border-radius: 7px;
  color: var(--sf-shell-ink);
  display: inline-flex;
  font-size: 12px;
  min-height: 36px;
  padding: 0 11px;
  text-decoration: none;
  white-space: nowrap;
}

.sf-shell-signin {
  background: var(--sf-shell-green);
  border-color: var(--sf-shell-green);
  color: #fff;
  font-weight: 800;
}

.sf-shell-user-link:hover,
.sf-shell-user-link:focus-visible,
.sf-shell-signin:hover,
.sf-shell-signin:focus-visible {
  border-color: var(--sf-shell-green);
  outline: 0;
}

.sf-shell-mobile-nav {
  display: none;
  transition: transform .2s ease;
}

.sf-shell-mobile-nav.is-scroll-hidden {
  pointer-events: none;
  transform: translateY(100%);
}

@media (prefers-reduced-motion: reduce) {
  .sf-shell-mobile-nav {
    transition: none;
  }
}

.sf-shell-mobile-pending {
  align-items: center;
  color: var(--sf-shell-muted);
  display: grid;
  font-size: 10px;
  justify-items: center;
  min-height: 48px;
  padding: 3px 2px;
}

.sf-shell-mobile-menu {
  display: none;
}

.sf-shell-mobile-menu[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  body.sf-unified-page {
    --sf-shell-mobile-nav-clearance: calc(76px + env(safe-area-inset-bottom));
    padding-bottom: var(--sf-shell-mobile-nav-clearance);
    padding-left: 0;
    padding-top: 58px;
    scroll-padding-bottom: var(--sf-shell-mobile-nav-clearance);
  }

  body.sf-unified-page :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    scroll-margin-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .sf-shell-rail {
    display: none;
  }

  .sf-shell-topbar {
    height: 58px;
    left: 0;
    padding: 8px 12px;
  }

  .sf-shell-location small,
  .sf-shell-search {
    display: none;
  }

  .sf-shell-location strong {
    font-size: 14px;
  }

  .sf-shell-mobile-account {
    display: inline-flex;
    flex: 0 1 auto;
  }

  /* The fixed mobile navigation already provides the single sign-in entry.
     Keep the header account slot for the signed-in identity only. */
  .sf-shell-mobile-account-signin {
    display: none;
  }

  .sf-shell-topbar-actions {
    display: none;
  }

  .sf-shell-user-link,
  .sf-shell-signin {
    font-size: 11px;
    min-height: 34px;
    padding: 0 9px;
  }

  .sf-shell-mobile-nav {
    background: #fff;
    border-top: 1px solid var(--sf-shell-line);
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(var(--sf-mobile-nav-count, 5), minmax(0, 1fr));
    left: 0;
    padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    z-index: 80;
  }

  .sf-shell-mobile-nav a {
    align-items: center;
    color: var(--sf-shell-muted);
    display: grid;
    font-size: 10px;
    gap: 2px;
    justify-items: center;
    min-height: 48px;
    padding: 3px 2px;
    text-decoration: none;
  }

  .sf-shell-mobile-nav a.is-active {
    color: var(--sf-shell-green-dark);
    font-weight: 800;
  }

  .sf-shell-mobile-nav a[hidden] {
    display: none;
  }

  body.sf-mobile-menu-open {
    overflow: hidden;
  }

  .sf-shell-mobile-menu:not([hidden]) {
    display: block;
    inset: 0;
    position: fixed;
    z-index: 100;
  }

  .sf-shell-mobile-menu-backdrop {
    background: rgba(23, 33, 29, .34);
    inset: 0;
    position: absolute;
  }

  .sf-shell-mobile-menu-panel {
    background: var(--sf-shell-paper);
    border-radius: 14px 14px 0 0;
    bottom: 0;
    box-shadow: 0 -10px 30px rgba(23, 33, 29, .18);
    display: grid;
    gap: 12px;
    left: 0;
    max-height: min(82vh, 720px);
    overflow-y: auto;
    padding: 16px 14px calc(84px + env(safe-area-inset-bottom));
    position: absolute;
    right: 0;
  }

  .sf-shell-mobile-menu-head {
    align-items: center;
    border-bottom: 1px solid var(--sf-shell-line);
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
  }

  .sf-shell-mobile-menu-head strong {
    font-size: 16px;
  }

  .sf-shell-mobile-menu-close {
    background: var(--sf-shell-soft);
    border: 1px solid var(--sf-shell-line);
    border-radius: 7px;
    color: var(--sf-shell-ink);
    cursor: pointer;
    min-height: 42px;
    padding: 0 13px;
  }

  .sf-shell-mobile-menu-list {
    display: grid;
    gap: 14px;
  }

  .sf-shell-mobile-menu-list .sf-shell-nav-group {
    display: grid;
    gap: 4px;
    margin: 0;
  }

  .sf-shell-mobile-menu-list .sf-shell-nav-label {
    padding: 2px 4px 4px;
  }

  .sf-shell-mobile-menu-list a {
    align-items: center;
    border: 1px solid var(--sf-shell-line);
    border-radius: 8px;
    color: var(--sf-shell-ink);
    display: flex;
    font-size: 14px;
    gap: 10px;
    min-height: 48px;
    padding: 8px 12px;
    text-decoration: none;
  }

  .sf-shell-mobile-menu-list a.is-active {
    background: var(--sf-shell-soft);
    border-color: var(--sf-shell-green);
    color: var(--sf-shell-green-dark);
    font-weight: 800;
  }

  .sf-shell-mobile-menu-context {
    border-top: 1px solid var(--sf-shell-line);
    display: grid;
    gap: 6px;
    padding-top: 12px;
  }

  .sf-shell-mobile-menu-context span {
    color: var(--sf-shell-muted);
    font-size: 11px;
    font-weight: 700;
  }

  .sf-shell-mobile-menu-context select {
    background: var(--sf-shell-paper);
    border: 1px solid var(--sf-shell-line);
    border-radius: 7px;
    color: var(--sf-shell-ink);
    font-size: 14px;
    min-height: 44px;
    padding: 6px 9px;
    width: 100%;
  }

  .sf-shell-mobile-menu-context.sf-shell-context-directory {
    align-content: start;
    gap: 5px;
  }

  .sf-shell-mobile-menu-context.sf-shell-context-directory span {
    color: var(--sf-shell-muted);
    font-size: 11px;
    font-weight: 700;
  }

  .sf-shell-mobile-menu-context.sf-shell-context-directory strong {
    color: var(--sf-shell-ink);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sf-shell-mobile-menu-context.sf-shell-context-directory small {
    color: var(--sf-shell-muted);
    font-size: 12px;
  }

  .sf-shell-mobile-menu-context.sf-shell-context-directory a {
    align-items: center;
    border: 1px solid var(--sf-shell-line);
    border-radius: 8px;
    color: var(--sf-shell-green-dark);
    display: flex;
    font-size: 14px;
    font-weight: 800;
    min-height: 44px;
    padding: 8px 12px;
    text-decoration: none;
  }

  .sf-shell-mobile-menu-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--sf-shell-muted);
    cursor: pointer;
    display: grid;
    font: inherit;
    font-size: 10px;
    gap: 2px;
    justify-items: center;
    min-height: 48px;
    padding: 3px 2px;
  }

  .sf-shell-mobile-menu-toggle[aria-expanded="true"] {
    color: var(--sf-shell-green-dark);
    font-weight: 800;
  }
}

/* Keep the shell independent from page content while using the same control
   scale as public and workspace surfaces. */
.sf-app-shell {
  font-size: 14px;
  line-height: 1.5;
}

.sf-shell-rail {
  gap: 18px;
  padding: 16px 14px;
}

.sf-shell-nav {
  gap: 4px;
}

.sf-shell-nav-group {
  gap: 4px;
  margin-top: 12px;
}

.sf-shell-nav-label {
  font-size: 11px;
  letter-spacing: .04em;
}

.sf-shell-nav a {
  min-height: 40px;
  border-radius: 6px;
  font-size: 14px;
  padding: 8px 10px;
}

.sf-shell-topbar {
  gap: 16px;
  min-height: var(--sf-shell-top);
}

.sf-shell-location strong {
  font-size: 16px;
}

.sf-shell-search,
.sf-shell-user-link,
.sf-shell-signin {
  min-height: 40px;
  border-radius: 6px;
}

.sf-shell-search input {
  font-size: 14px;
}

@media (max-width: 760px) {
  .sf-shell-topbar {
    min-height: 58px;
  }

  .sf-shell-mobile-nav a {
    min-height: 48px;
    font-size: 11px;
  }
}

.sf-shell-nav a:focus-visible,
.sf-shell-mobile-nav a:focus-visible,
.sf-shell-user-link:focus-visible,
.sf-shell-signin:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .28);
  outline-offset: 2px;
}
