/* Shared study frame: content and persistence remain owned by each module. */
.cw-shell {
  min-height: 100dvh;
  --cw-sidebar-width: 232px;
  --pg-sidebar: var(--cw-sidebar-width);
  --blue: #5e6ad2;
  --blue-dark: #4f58b2;
  --soft: #f7f7f8;
  font-size: 14px;
  line-height: 1.55;
  background: var(--white);
}
.cw-shell [hidden] {
  display: none !important;
}
.cw-shell .cw-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 90;
  width: var(--cw-sidebar-width);
  height: 100dvh;
  padding: 18px 12px 14px;
  border-right: 1px solid var(--line);
  background: var(--soft);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cw-shell .cw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  min-height: 32px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.cw-shell .cw-program {
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.cw-shell .cw-program strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
}
.cw-nav-group {
  display: grid;
  gap: 5px;
}
.cw-shell .cw-primary-nav,
.cw-shell .cw-study-nav {
  flex: none;
}
.cw-shell .cw-fixed-program-nav > .cw-program,
.cw-shell .cw-fixed-program-nav > .ar-sb__identity {
  height: 44px;
  min-height: 44px;
  flex-shrink: 0;
  padding: 0 10px;
  margin: 0;
}
.cw-shell .cw-fixed-program-nav .cw-brand img {
  width: 32px;
  height: 32px;
}
.cw-shell .cw-study-nav {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.cw-section-label {
  display: block;
  color: var(--muted);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
}
.cw-shell .cw-sidebar nav {
  display: grid;
  gap: 3px;
  overflow: visible;
}
.cw-shell .cw-sidebar nav a {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  white-space: normal;
  line-height: 1.4;
}
.cw-shell .cw-sidebar nav a:hover {
  background: var(--line);
  color: var(--ink);
}
.cw-shell .cw-sidebar nav a[aria-current="page"] {
  color: var(--ink);
  background: #eaeaef;
  font-weight: 500;
}
.cw-shell .cw-sidebar nav a > span {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.cw-nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  opacity: 0.85;
}
.cw-shell .cw-sidebar [data-study-series] {
  margin: 0 2px;
}
.cw-shell .cw-sidebar .study-series-trigger {
  font-size: 13px;
  min-height: 36px;
}
.cw-shell .cw-sidebar .study-series-context {
  font-size: 11px;
  line-height: 1.45;
}
.cw-shell .cw-sidebar-bottom {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.cw-sidebar-bottom a {
  padding-block: 3px;
}
.cw-shell .cw-sidebar-bottom button {
  min-height: 34px;
  font-size: 12px;
}
.cw-shell .cw-sidebar-bottom p {
  margin: 0;
  font-size: 11px;
}
.cw-shell .cw-frame {
  min-width: 0;
  margin-left: var(--cw-sidebar-width);
}
.cw-shell .cw-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 49px;
  min-height: 49px;
  padding: 0 28px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.cw-topbar > span:first-of-type {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cw-topbar strong {
  color: var(--ink);
  font-weight: 500;
}
.cw-topbar > span:last-of-type {
  font-size: 11px;
}
.cw-shell .cw-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 60px;
}
.cw-shell .cw-main h1,
.cw-shell #study-intro > h1 {
  font-size: clamp(24px, 2.6vw, 30px);
  letter-spacing: -0.035em;
  line-height: 1.25;
}
.cw-shell #study-intro > h1 {
  margin: 10px 0 12px;
}
.cw-shell
  #study-intro[data-access-blocked]
  > :is(.ped-lead, .ped-small, .ped-actions, .ped-history) {
  display: none;
}
.cw-shell .ped-lead {
  font-size: 14px;
  max-width: 68ch;
}
.cw-shell .personal-summary {
  top: 68px;
}
.cw-shell .cw-menu-toggle,
.cw-shell .cw-menu-close {
  display: none;
}
.cw-shell .cw-search {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.cw-shell kbd {
  font-family: inherit;
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
}
.cw-shell :focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.cw-shell .study-sync {
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.cw-shell .study-sync:empty {
  display: none;
}
.cw-shell .study-sync button {
  min-height: 30px;
  padding: 4px 9px;
  border-color: var(--line);
  margin-block: 0;
}
.cw-shell .pg-heading {
  margin-bottom: 20px;
}
.cw-shell .pg-heading h1 {
  margin-block: 8px 12px;
}
.cw-shell .ad-sidebar-project {
  display: grid;
  padding: 0 10px;
  font-size: 12px;
}
.cw-shell .ped-footer {
  margin-left: var(--cw-sidebar-width);
  padding: 16px 28px;
}
.cw-command {
  width: min(560px, calc(100vw - 32px));
  max-height: 80dvh;
  overflow: auto;
  margin-top: min(18vh, 140px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}
.cw-command::backdrop {
  background: #10121b55;
  backdrop-filter: blur(3px);
}
.cw-command header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.cw-command h2 {
  font-size: 16px;
  margin: 0;
}
.cw-command label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  margin: 18px 0;
}
.cw-command input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
.cw-command nav {
  display: grid;
  gap: 3px;
}
.cw-command nav a {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.cw-command nav a:hover,
.cw-command nav a:focus-visible {
  background: var(--soft);
}
.cw-command p {
  font-size: 12px;
  color: var(--muted);
}
.cw-shell .cw-menu-backdrop {
  display: none;
}
@media (max-width: 760px) {
  .cw-shell .cw-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .cw-shell .cw-frame,
  .cw-shell .ped-footer {
    margin-left: 0;
  }
  .cw-shell .cw-topbar {
    padding: 0 16px;
    gap: 10px;
  }
  .cw-shell .cw-topbar > span:last-of-type {
    max-width: 36%;
    text-align: right;
    line-height: 1.3;
  }
  .cw-shell .cw-main {
    padding: 22px 18px 48px;
  }
  .cw-shell .pg-workspace {
    position: static;
    text-align: left;
  }
  .cw-shell.cw-ready .cw-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, calc(100vw - 48px));
    height: 100dvh;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    z-index: 111;
  }
  .cw-shell.cw-ready .cw-menu-toggle,
  .cw-shell.cw-ready .cw-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: var(--white);
    cursor: pointer;
  }
  .cw-shell.cw-ready .cw-menu-close {
    position: absolute;
    top: 16px;
    right: 12px;
  }
  .cw-shell.cw-menu-open {
    overflow: hidden;
  }
  .cw-shell.cw-menu-open .cw-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: #10121b66;
    border: 0;
    border-radius: 0;
    padding: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cw-shell *,
  .cw-shell *::before,
  .cw-shell *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
