/* Requires shared chipter-design-tokens. Geometry only; same accepted renderer contract. */
html:is(.c4-redesign,.cc-unified-shell) body { margin:0;padding-top:0;background:var(--chipter-bg);color:var(--chipter-text);font:400 15px/1.5 var(--chipter-font);letter-spacing:0; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell { display:grid;grid-template-columns:var(--chipter-rail-width) minmax(0,1fr);min-height:100dvh;max-width:1680px;margin:auto;background:var(--chipter-bg); }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-stage { min-width:0;display:flex;flex-direction:column;background:var(--chipter-bg); }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail { width:auto;position:sticky;inset:auto;top:0;height:100dvh;max-height:100dvh;border:0;border-right:1px solid var(--chipter-border);background:var(--chipter-surface);padding:24px 10px 18px;display:flex;flex-direction:column;gap:24px;z-index:40; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-brand { padding:0 12px;display:flex;align-items:center;gap:11px;color:var(--chipter-text)!important;text-decoration:none;font:750 24px/1.15 var(--chipter-font);letter-spacing:-.5px;min-width:0; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-brand img { width:36px;height:36px;flex-shrink:0; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-brand span { min-width:0;white-space:nowrap; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-brand b { font-weight:400; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav { display:flex;flex-direction:column;gap:6px;margin:0;padding:0;position:static;height:auto;width:auto;background:transparent;border:0;border-radius:0; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link { display:flex;align-items:center;gap:13px;min-height:48px;padding:12px 14px;margin:0;border-radius:10px;color:var(--chipter-muted)!important;text-decoration:none;font:500 15px/1.5 var(--chipter-font);border:0;background:transparent; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link>span:first-child { display:flex; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link:is(.active,[aria-current="page"]) { color:var(--chipter-accent)!important;background:var(--chipter-soft);box-shadow:none; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link:hover { background:var(--chipter-raised);color:var(--chipter-text)!important; }
html:is(.c4-redesign,.cc-unified-shell) :is(.chipter-shell-nav,.chipter-shell-actions,.chipter-shell-rail-bottom) svg { width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-bottom { margin-top:auto;display:grid;gap:14px;padding:0 8px; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-bottom button { display:flex;align-items:center;gap:12px;background:transparent;border:0;text-align:left;padding:12px 8px;color:var(--chipter-text);font:600 14px/1.5 var(--chipter-font);min-height:44px;border-radius:12px;cursor:pointer; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-top { position:relative;inset:auto;height:var(--chipter-top-height);min-height:var(--chipter-top-height);padding:0;border:0;border-bottom:1px solid var(--chipter-border);background:var(--chipter-surface);z-index:30;display:block; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-top-inner { height:100%;min-height:0;width:100%;max-width:none;margin:0;padding:0 32px;display:flex;align-items:center;justify-content:space-between;gap:16px; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-caption { font-size:13px;font-weight:600;color:var(--chipter-muted);letter-spacing:.2px; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-actions { display:flex;align-items:center;gap:8px;margin-left:auto;min-width:0; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-actions button { display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-height:44px;padding:10px;border:0;border-radius:12px;background:transparent;color:var(--chipter-text);flex-shrink:0;cursor:pointer; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-actions button:hover { background:var(--chipter-raised); }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-connection { font-size:11px;max-width:180px;text-align:right;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-mobile-brand { display:none; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell :is(a,button):focus-visible { outline:3px solid var(--chipter-focus)!important;outline-offset:3px!important; }
/* Canonical content adapter: the shared stage replaces the old topbar/sidebar framing. */
html.cc-unified-shell .chipter-shell-stage > .wrap.content-page { max-width:1040px;width:100%;margin:0 auto;padding:32px 36px 48px;min-height:0;flex:1; }
html.cc-unified-shell .chipter-shell-stage .main-column { margin:0;gap:24px; }
html.cc-unified-shell #main-footer { max-width:1040px;margin:0 auto 0 calc((100% - min(100%,1680px))/2 + var(--chipter-rail-width)); }
html.cc-unified-shell .cc-menu-dialog .cc-search { margin:20px 0;max-width:none;width:100%;height:48px; }
html.cc-unified-shell .cc-shell-account { display:flex;gap:12px;align-items:center;padding:12px 0 20px;border-bottom:1px solid var(--chipter-border); }
html.cc-unified-shell .cc-shell-account a { min-height:44px;display:inline-flex;align-items:center;gap:8px; }
html.cc-unified-shell .cc-shell-menu-links { display:flex;flex-wrap:wrap;gap:4px 16px;margin-top:20px; }
html.cc-unified-shell .cc-shell-menu-links :is(a,button) { min-height:44px;display:inline-flex;align-items:center;background:transparent;color:var(--chipter-muted);border:0;font:inherit; }
/* Post detail is one reading card, not a stack of nested decorative shells. */
html.cc-unified-shell.cc-post-ui4 .sidebar-right-menu { flex:0 0 100%!important;max-width:100%!important;order:-1!important;padding:0!important;margin:0; }
html.cc-unified-shell.cc-post-ui4 .sidebar-right-menu .card { border:0;border-radius:0;background:transparent;box-shadow:none;margin:0; }
html.cc-unified-shell.cc-post-ui4 .sidebar-right-menu .ls-menu { display:flex;flex-wrap:wrap;gap:4px;padding:0 0 12px;border-bottom:1px solid var(--chipter-border); }
html.cc-unified-shell.cc-post-ui4 .sidebar-right-menu .ls-menu-item { padding:9px 14px;min-height:42px;border-radius:8px;margin:0;font-size:13px; }
html.cc-unified-shell.cc-post-ui4 #content { flex-basis:100%!important;width:100%; }
html.cc-unified-shell.cc-post-ui4 #post-editor { padding:0;border:0;background:transparent;box-shadow:none;margin:0 0 16px; }
html.cc-unified-shell.cc-post-ui4 #post-editor > summary { background:transparent;border:0;padding:8px 0;min-height:44px;color:var(--chipter-muted);font-size:13px;cursor:pointer; }
html.cc-unified-shell.cc-post-ui4 #post-editor[open] > form { background:var(--chipter-surface);border:1px solid var(--chipter-border);border-radius:16px;padding:20px; }
html.cc-unified-shell.cc-post-ui4 .items-list.content-list > .card { border:0;border-radius:0;background:transparent;box-shadow:none;margin:0;padding:0; }
html.cc-unified-shell.cc-post-ui4 .cv-post-shell { border:1px solid var(--chipter-border);border-radius:20px!important;background:var(--chipter-surface);box-shadow:none;overflow:visible;list-style:none;margin:0; }
html.cc-unified-shell.cc-post-ui4 .cv-post-shell .item-meta.post-item-content { border:0;border-radius:0;background:transparent;box-shadow:none; }
html.cc-unified-shell.cc-post-ui4 .cv-post-shell .comment_form { border:0;border-top:1px solid var(--chipter-border);border-radius:0 0 20px 20px;background:var(--chipter-raised);margin:0;padding:14px; }
@media(max-width:1100px) {
 html:is(.c4-redesign,.cc-redesign) { --chipter-rail-width:88px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail { padding:24px 12px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-brand { padding:0;justify-content:center; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-brand .chipter-shell-brand>span,html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link>span:last-child,html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-bottom button>span:last-child { display:none; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link { justify-content:center;padding:14px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-bottom { padding:0; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-bottom button { justify-content:center;padding:12px; }
 html.cc-unified-shell .chipter-shell-stage > .wrap.content-page { padding:28px; }
}
@media(max-width:767px) {
 html:is(.c4-redesign,.cc-redesign) { --chipter-top-height:64px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell { display:block;min-height:100dvh;padding-bottom:calc(76px + env(safe-area-inset-bottom,0px)); }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail { position:fixed;inset:auto 0 0;height:calc(76px + env(safe-area-inset-bottom,0px));width:100%;max-height:none;padding:0 8px env(safe-area-inset-bottom,0px);border:0;border-top:1px solid var(--chipter-border);background:var(--chipter-surface);display:block; }
 html:is(.c4-redesign,.cc-unified-shell) :is(.chipter-shell-rail-brand,.chipter-shell-rail-bottom) { display:none; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav { height:76px;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;align-items:center; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link { display:flex;flex-direction:column;gap:3px;justify-content:center;min-height:56px;padding:7px 3px;border-radius:12px;font-size:10px;line-height:1.2; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link>span:last-child { display:block; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-top-inner { padding:0 16px;gap:8px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-mobile-brand { display:flex;align-items:center;justify-content:flex-start;gap:9px;text-decoration:none;font-size:15px;letter-spacing:-.3px;min-width:0;flex:1 1 auto; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-mobile-brand img { width:28px;height:28px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-mobile-brand span { overflow:hidden;text-overflow:ellipsis; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-mobile-brand b { font-weight:600; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-caption { display:none; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-actions { gap:0;flex:0 0 auto; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-actions button { width:40px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-connection { font-size:9px;flex:0 1 56px;max-width:56px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0; }
 html.cc-unified-shell .chipter-shell-stage > .wrap.content-page { padding:24px 16px 32px; }
 html.cc-unified-shell #main-footer { margin:0 0 calc(76px + env(safe-area-inset-bottom,0px)); }
 html.cc-unified-shell.cc-post-ui4 .cv-post-shell { border-radius:16px!important; }
 html.cc-unified-shell.cc-post-ui4 .cv-post-shell .comment_form { border-radius:0 0 16px 16px; }
 html.c4-redesign body.keyboard .chipter-shell-rail,html.cc-unified-shell.cc-keyboard-open .chipter-shell-rail { display:none; }
 html.c4-redesign body.keyboard .chipter-shell,html.cc-unified-shell.cc-keyboard-open .chipter-shell { padding-bottom:0; }
}
@media(prefers-reduced-motion:reduce) { .chipter-shell * { transition:none!important;scroll-behavior:auto!important; } }
/* Reset inherited UI4 dot-only mobile status sizing; keep the real status text accessible. */
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-connection { width:auto;height:auto;display:inline-block; }
@media(max-width:767px) {
 html.c4-redesign body.keyboard .chipter-shell { min-height:var(--app-height,100dvh); }
}
html.c4-redesign .chipter-shell { height:var(--app-height,100dvh); }

/* Scroll the full-height desktop/tablet rail rather than clip controls in landscape or at enlarged text. */
@media(min-width:768px) {
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail { min-height:0;overflow-y:auto; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail > :is(.chipter-shell-brand,.chipter-shell-nav,.chipter-shell-rail-bottom) { flex-shrink:0; }
}

/* Graphite reference: restrained chrome, bright leading navigation rule, real account footer. */
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link { position:relative; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link:is(.active,[aria-current="page"]) { color:var(--chipter-text)!important; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link:is(.active,[aria-current="page"])>span:first-child { color:var(--chipter-accent); }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link:is(.active,[aria-current="page"])::before { content:"";position:absolute;left:0;top:8px;bottom:8px;width:2px;border-radius:2px;background:var(--chipter-accent); }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-bottom { border-top:1px solid var(--chipter-border);padding-top:14px; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-account { display:flex;align-items:center;gap:10px;min-height:48px;padding:4px 10px;margin-bottom:8px;text-decoration:none;color:var(--chipter-text);font-weight:600;font-size:13px;min-width:0; }
.chipter-shell-account img { width:36px;height:36px;border-radius:50%;object-fit:cover;flex:none; }
.chipter-shell-account>span { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-caption { color:var(--chipter-muted);font-weight:400;font-size:13px; }
html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-top { border-bottom:1px solid var(--chipter-border); }
html.cc-unified-shell .chipter-shell-stage > .wrap.content-page { max-width:1280px;padding:24px; }
@media(min-width:1101px) { html:is(.c4-redesign,.cc-unified-shell) .chipter-shell { border-inline:1px solid var(--chipter-border); } }
@media(min-width:768px) and (max-width:1100px) {
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-brand { font-size:11px;letter-spacing:0; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-rail-brand .chipter-shell-brand>span { display:block; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-account { justify-content:center;padding:4px 0; }
 .chipter-shell-account>span { display:none; }
}
@media(max-width:767px) {
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-mobile-brand { font-weight:750;font-size:19px; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link:is(.active,[aria-current="page"]) { background:transparent;color:var(--chipter-accent)!important; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link:is(.active,[aria-current="page"])::before { display:none; }
 html:is(.c4-redesign,.cc-unified-shell) .chipter-shell-nav-link { font-size:11px;gap:5px; }
 html.cc-unified-shell .chipter-shell-stage > .wrap.content-page { padding:16px 12px 24px; }
}

/* Guest entry: one header/menu owner, three real destinations. Authenticated geometry is unchanged. */
html.c4-guest { --chipter-rail-width:216px;--chipter-top-height:72px; }
html.c4-guest .chipter-shell { grid-template-rows:72px minmax(0,1fr);height:100dvh;max-width:1680px; }
html.c4-guest .chipter-guest-top { grid-column:1/-1;grid-row:1;position:sticky;top:0;height:72px;min-height:72px;z-index:45; }
html.c4-guest .chipter-shell-top-inner { padding:0 24px; }
.chipter-guest-identity { display:flex;align-items:center;gap:14px;min-width:0; }
.chipter-guest-top .chipter-shell-mobile-brand { display:flex!important;flex:none;padding:0;font-size:20px;letter-spacing:.015em; }
.chipter-guest-menu { display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;padding:10px;background:transparent;border:1px solid var(--chipter-border);border-radius:12px;color:var(--chipter-text);cursor:pointer; }
.chipter-guest-menu svg { width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round; }
html.c4-guest .chipter-shell-mobile-brand { display:flex!important;flex:none;padding:0;font-size:20px;font-weight:750;letter-spacing:.025em;line-height:1.2; }
html.c4-guest .chipter-shell-mobile-brand span { display:block!important;white-space:nowrap;overflow:visible; }
html.c4-guest .chipter-guest-rail { grid-column:1;grid-row:2;position:relative;top:auto;height:100%;max-height:none;padding:26px 14px;gap:0; }
html.c4-guest .chipter-shell-stage { grid-column:2;grid-row:2;min-height:0;height:100%;overflow:hidden; }
html.c4-guest #workspace { overflow:auto;min-height:0;flex:1 1 0%;scroll-padding-top:24px; }
html.c4-guest .chipter-shell-nav-link { min-height:50px;padding:12px 14px;font-size:14px;gap:12px; }
html.c4-guest .chipter-shell-nav { gap:8px; }
html.c4-guest .chipter-shell-nav-link>span:last-child { display:block; }
html.c4-guest :is(a,button,input,summary):focus-visible { outline:2px solid var(--chipter-focus);outline-offset:4px; }
html.c4-guest .chipter-guest-menu:hover { background:var(--chipter-raised); }
html.c4-guest #chipter-drawer { width:min(336px,calc(100vw - 24px));padding:24px 20px; }
html.c4-guest #chipter-drawer .chipter-drawer-heading { margin-bottom:28px; }
html.c4-guest #chipter-drawer .chipter-drawer-heading strong { font-size:20px;letter-spacing:.015em; }
html.c4-guest #chipter-drawer .chipter-drawer-nav { display:grid;gap:8px; }
html.c4-guest #chipter-drawer .chipter-shell-nav-link { justify-content:flex-start; }
html.c4-guest #chipter-drawer .chipter-drawer-section { margin-top:26px;padding-top:22px; }
@media(min-width:768px) and (max-width:1000px) {
 html.c4-guest { --chipter-rail-width:84px; }
 html.c4-guest .chipter-guest-rail { padding:24px 10px; }
 html.c4-guest .chipter-guest-rail .chipter-shell-nav-link { padding:14px;justify-content:center; }
 html.c4-guest .chipter-guest-rail .chipter-shell-nav-link>span:last-child { display:none; }
}
@media(max-width:767px) {
 html.c4-guest { --chipter-top-height:64px; }
 html.c4-guest .chipter-shell { display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:64px minmax(0,1fr);padding-bottom:calc(72px + env(safe-area-inset-bottom,0px)); }
 html.c4-guest .chipter-guest-top { grid-column:1;height:64px;min-height:64px; }
 html.c4-guest .chipter-shell-top-inner { padding:0 16px;gap:8px; }
 html.c4-guest .chipter-guest-identity { gap:12px; }
 html.c4-guest .chipter-shell-mobile-brand { font-size:17px;letter-spacing:.015em; }
 html.c4-guest .chipter-shell-actions { margin-left:auto; }
 html.c4-guest .chipter-shell-actions button { width:44px;min-height:44px; }
 html.c4-guest .chipter-shell-stage { grid-column:1;grid-row:2; }
 html.c4-guest .chipter-guest-rail { position:fixed;inset:auto 0 0;grid-column:auto;grid-row:auto;height:calc(72px + env(safe-area-inset-bottom,0px));width:100%;padding:0 10px env(safe-area-inset-bottom,0px);border-right:0;z-index:44; }
 html.c4-guest .chipter-shell-nav[data-guest-navigation],.chipter-shell-nav[data-guest-navigation] { grid-template-columns:repeat(3,minmax(0,1fr)); }
 html.c4-guest .chipter-shell-nav { height:72px;gap:6px; }
 html.c4-guest .chipter-shell-nav-link { min-height:56px;padding:7px 3px;font-size:11px;gap:4px; }
 html.c4-guest .chipter-guest-rail .chipter-shell-nav-link.active { background:var(--chipter-soft); }
 html.c4-guest #chipter-drawer .chipter-shell-nav-link { flex-direction:row;justify-content:flex-start;gap:14px;font-size:14px; }
}
