/* Shared panel geometry. Load after shell.css and motion.css.
   Business sheets retain their original refs, close handlers and focus traps. */
.tc-shell{
  --tc-panel-radius:20px;
  --tc-panel-gap:16px;
  --tc-panel-shadow:-16px 8px 48px rgb(0 0 0 / .16);
  --tc-panel-scrim:rgb(0 0 0 / .28);
  --tc-panel-duration:240ms;
  --tc-panel-ease:cubic-bezier(.2,.8,.2,1);
}
.tc-shell[data-theme="dark"]{
  --tc-panel-shadow:-16px 8px 48px rgb(0 0 0 / .42);
  --tc-panel-scrim:rgb(0 0 0 / .52);
}
.tc-shell .tc-sheet-wrap>.tc-ui-sheet{
  border-radius:var(--tc-panel-radius)!important;
  box-shadow:var(--tc-panel-shadow)!important;
  overflow:hidden;
  min-height:0;
  isolation:isolate;
}
.tc-shell .tc-sheet-wrap>button:first-child{
  background:var(--tc-panel-scrim)!important;
  animation:tcPanelScrim var(--tc-panel-duration) ease-out;
}
.tc-shell .tc-sheet-wrap>.tc-ui-sheet>.tc-grabber{
  margin-top:10px!important;
  margin-bottom:4px;
  width:32px!important;
  height:4px!important;
}
.tc-shell .tc-sheet-wrap>.tc-ui-sheet>[data-ui="PageHeader"]{
  flex-shrink:0;
  border-bottom:1px solid var(--tc-line);
}
@media(max-width:699px){
  .tc-shell .tc-sheet-wrap{padding:8px 8px 0!important}
  .tc-shell .tc-sheet-wrap>.tc-ui-sheet{
    width:100%!important;
    max-height:calc(100% - 8px)!important;
    border-radius:var(--tc-panel-radius) var(--tc-panel-radius) 0 0!important;
  }
}
/* Compact forms keep their centered form layout. Only existing drawers receive
   inset drawer geometry; no long reader or full form is converted here. */
@media(min-width:700px){
  .tc-shell .tc-sheet-wrap:not(.tc-compact):not(.tc-wide-dialog):not(.tc-g-dialog):not(.tc-sh-form):not(.tc-tgc-form){
    padding:var(--tc-panel-gap)!important;
    flex-direction:row!important;
    justify-content:flex-end!important;
    align-items:stretch!important;
  }
  .tc-shell .tc-sheet-wrap:not(.tc-compact):not(.tc-wide-dialog):not(.tc-g-dialog):not(.tc-sh-form):not(.tc-tgc-form)>.tc-ui-sheet{
    width:min(480px,100%)!important;
    height:100%!important;
    max-height:100%!important;
  }
  .tc-shell .tc-sheet-wrap.tc-lb-drawer>.tc-ui-sheet{width:min(440px,100%)!important}
}
/* Nonmodal context panels: retain the module's close/escape/focus behavior.
   Explicit opt-in only. Search, spaces, history, lessons and forms stay full. */
@media(min-width:1100px){
  .tc-shell [data-context-panel="true"]{
    inset:var(--tc-panel-gap) var(--tc-panel-gap) var(--tc-panel-gap) auto!important;
    width:min(620px,62%)!important;
    border-radius:var(--tc-panel-radius);
    box-shadow:var(--tc-panel-shadow);
    overflow:hidden;
    isolation:isolate;
  }
  .tc-shell [data-context-panel="true"]>[data-ui="PageHeader"],
  .tc-shell [data-context-panel="true"]>div:first-child>[data-ui="PageHeader"]{
    border-bottom:1px solid var(--tc-line);
  }
}
@keyframes tcPanelScrim{from{opacity:0}to{opacity:1}}
@keyframes tcPanelEnter{from{opacity:0;transform:translateX(24px)}to{opacity:1;transform:translateX(0)}}
@media(min-width:700px) and (prefers-reduced-motion:no-preference){
  .tc-shell .tc-sheet-wrap:not(.tc-fs-out):not(.tc-compact):not(.tc-wide-dialog):not(.tc-g-dialog):not(.tc-sh-form):not(.tc-tgc-form)>.tc-ui-sheet{
    animation:tcPanelEnter var(--tc-panel-duration) var(--tc-panel-ease)!important;
  }
}
@media(min-width:1100px) and (prefers-reduced-motion:no-preference){
  .tc-shell [data-context-panel="true"]{animation:tcPanelEnter var(--tc-panel-duration) var(--tc-panel-ease)!important}
}
@media(prefers-reduced-motion:reduce){
  .tc-shell .tc-sheet-wrap>button:first-child,
  .tc-shell .tc-sheet-wrap>.tc-ui-sheet,
  .tc-shell [data-context-panel="true"]{animation:none!important;transition:none!important}
}

/* Desktop navigation has one surface model. Legacy export offsets (nav+list)
   are neutralized here for every page, not repeated in route-specific patches.
   Context panels opt in; long reading, messaging and settings remain full page. */
@media(min-width:700px){
 .tc-shell-content .tc-root>.tc-l-list{left:0!important;right:0!important;width:auto!important;padding-left:0!important;border-right:0!important}
 .tc-shell-content .tc-root>.tc-l-detail,
 .tc-shell-content .tc-root>.tc-l-history,
 .tc-shell-content .tc-root>.tc-l-reader{left:0!important;right:0!important;width:auto!important}
 .tc-shell-content .tc-l-empty{display:none!important}
 .tc-shell-content .tc-pane-scroll,
 .tc-shell-content .tc-pane-bar,
 .tc-shell-content .tc-hist-scroll{padding-left:var(--tc-gutter)!important;padding-right:var(--tc-gutter)!important}
 .tc-shell-content .tc-pane-scroll>*,
 .tc-shell-content .tc-pane-bar>*{max-width:760px;margin-left:auto;margin-right:auto}
 .tc-shell-content .tc-root>.tc-l-list>.tc-scroll:not(.tc-root-scroll){padding-inline:var(--tc-gutter)}
}
@media(min-width:1100px){
 .tc-shell-content .tc-root>[data-context-panel="true"],
 .tc-shell-content .tc-root>[data-sidepeek="true"]{
   inset:16px 16px 16px auto!important;width:min(620px,62%)!important;
   border:1px solid var(--tc-line);border-radius:var(--tc-panel-radius);
   box-shadow:var(--tc-panel-shadow);overflow:hidden;isolation:isolate;
 }
 .tc-shell-content [data-context-panel="true"]>.tc-scroll,
 .tc-shell-content [data-sidepeek="true"]>.tc-scroll{padding-top:24px!important}
}
