/* Course Writing. One continuous writing surface, with modules as outline dividers. */
.cw-page {
  --cw-outline-width: 284px;
  width: 100%;
  min-width: 0;
  color: var(--ui-text);
}
.cw-page-heading { display:flex; flex:none; align-items:center; justify-content:space-between; gap:20px; margin-bottom:25px; }
.cw-page-heading h1 { margin:0; font-size:var(--admin-title-size,34px); font-weight:650; line-height:1.15; letter-spacing:-.05em; }
.cw-page-actions { display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end; gap:9px; padding-top:2px; }
.cw-page .button { font-size:12px; min-height:39px; }
.cw-shell { position:relative; display:grid; grid-template-columns:var(--cw-outline-width) minmax(0,1fr); min-height:0; overflow:hidden; isolation:isolate; background:var(--ui-surface); border:0; border-radius:16px; box-shadow:none; }
.cw-mobile-navigation { display:none; }
/* Let the page fill the shared 24px desktop insets, like the navigation rail.
   The editor receives the space remaining below the actual heading height. */
@media (width > 760px) {
  .workspace-course-writing .main { display:flex; flex-direction:column; height:100dvh; min-height:0; overflow:hidden; }
  .workspace-course-writing .cw-page { display:flex; flex-direction:column; flex:1; min-height:0; }
  .workspace-course-writing .cw-shell { flex:1; height:auto; min-height:0; max-height:none; }
}
.cw-outline { display:flex; flex-direction:column; min-height:0; min-width:0; padding:21px 14px 0; border-right:1px solid var(--ui-border); background:var(--ui-surface); }
.cw-outline-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:0 7px; }
.cw-outline-heading h2, .cw-outline-heading > span { margin:0; font-size:13px; font-weight:650; line-height:1.4; letter-spacing:-.015em; }
.cw-outline-heading > div { display:flex; align-items:center; gap:2px; }
.cw-page .icon-button { flex:none; display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; min-height:32px; padding:7px; border:0; border-radius:var(--ui-button-radius,12px); background:transparent; color:var(--ui-text-muted); }
.cw-page .icon-button .icon { width:16px; height:16px; }
.cw-page .icon-button:hover { color:var(--ui-text); background:var(--ui-surface-muted); }
.cw-page .icon-button:disabled { opacity:.3; cursor:default; }
.cw-page button:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
.cw-outline-list { flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; padding:20px 4px 22px; scrollbar-width:thin; scrollbar-color:var(--ui-border-strong) transparent; overscroll-behavior:contain; }
.cw-module + .cw-module { margin-top:12px; }
.cw-module-header { position:relative; display:flex; align-items:center; gap:3px; min-height:34px; margin-bottom:7px; }
.cw-module-toggle { display:flex; flex:1; align-items:flex-start; gap:7px; min-width:0; padding:8px 3px; border:0; background:transparent; text-align:left; color:var(--ui-text-secondary); }
.cw-module-toggle > .icon { flex:none; width:13px; height:13px; margin-top:3px; transition:transform .18s; }
.cw-module-toggle[aria-expanded="false"] > .icon { transform:rotate(-90deg); }
.cw-module-title { min-width:0; font-size:11px; line-height:1.65; font-weight:700; letter-spacing:.035em; overflow-wrap:anywhere; }
.cw-module-count { display:inline-grid; place-items:center; flex:none; min-width:18px; min-height:18px; margin:0 0 0 auto; padding:0 4px; border-radius:5px; background:var(--ui-surface-muted); color:var(--ui-text-muted); font-size:9px; font-weight:550; }
.cw-module-actions { display:flex; align-items:center; gap:0; }
.cw-module-actions .icon-button { width:27px; height:29px; padding:6px; }
.cw-module-actions .icon-button .icon { width:14px; height:14px; }
.cw-lessons { display:flex; flex-direction:column; gap:4px; }
.cw-lesson { position:relative; display:flex; align-items:center; min-width:0; border:1px solid transparent; border-radius:12px; transition:background .13s,border-color .13s; }
.cw-lesson:hover { background:var(--ui-surface-hover); }
.cw-lesson.is-selected { background:var(--ui-accent-soft); }
.cw-lesson-main { display:grid; grid-template-columns:26px minmax(0,1fr); align-items:start; column-gap:7px; flex:1; width:100%; min-width:0; padding:13px 9px; border:0; background:transparent; color:var(--ui-text-secondary); text-align:left; }
.cw-lesson.is-selected .cw-lesson-main { color:var(--ui-text); }
.cw-lesson-number { margin-top:1px; font-size:10px; font-weight:600; line-height:1.75; color:var(--ui-text-muted); font-variant-numeric:tabular-nums; }
.cw-lesson.is-selected .cw-lesson-number { color:var(--ui-accent); }
.cw-lesson-text { min-width:0; }
.cw-lesson-title { display:block; font-size:12px; font-weight:550; line-height:1.6; letter-spacing:-.01em; overflow-wrap:anywhere; white-space:normal; }
.cw-lesson.is-selected .cw-lesson-title { color:var(--ui-accent); font-weight:650; }
.cw-lesson-meta { display:flex; align-items:center; gap:5px; margin-top:6px; color:var(--ui-text-muted); font-size:10px; line-height:1.4; }
.cw-status-dot { display:inline-block; flex:none; width:5px; height:5px; border-radius:50%; background:var(--ui-text-muted); }
.cw-status-dot.is-to_translate { background:var(--ui-warning); }
.cw-status-dot.ready, .cw-status-dot.is-ready, .cw-status-dot[data-status="ready"] { background:var(--ui-accent); }
.cw-status-dot.recorded, .cw-status-dot.is-recorded, .cw-status-dot[data-status="recorded"] { background:var(--ui-success); }
.cw-lesson-actions { display:flex; align-items:center; align-self:flex-start; flex:none; gap:0; padding:9px 4px 0 0; }
.cw-lesson-actions .icon-button { width:27px; height:29px; padding:6px; }
.cw-lesson-actions .icon-button .icon { width:14px; height:14px; }
.cw-module-add { display:flex; align-items:center; gap:7px; width:100%; min-height:34px; margin:5px 0 0; padding:7px 10px 7px 12px; border:0; border-radius:12px; background:transparent; color:var(--ui-text-muted); font-size:11px; text-align:left; }
.cw-module-add > .icon { width:14px; height:14px; }
.cw-module-add:hover { color:var(--ui-accent); background:var(--ui-accent-soft); }
.cw-add-module { display:flex; align-items:center; gap:8px; width:100%; min-height:40px; margin:18px 0 0; padding:10px 12px; border:0; background:transparent; color:var(--ui-text-muted); font-size:12px; text-align:left; }
.cw-add-module > .icon { width:16px; height:16px; }
.cw-add-module:hover { color:var(--ui-accent); background:var(--ui-accent-soft); }
.cw-outline-footer { flex:none; padding:15px 8px 17px; border-top:1px solid var(--ui-border); color:var(--ui-text-muted); font-size:11px; line-height:1.5; }
.cw-outline-footer strong { font-weight:600; color:var(--ui-text-secondary); }
.cw-outline-footer > div:first-child { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:10px; }
.cw-progress { height:3px; margin-top:10px; overflow:hidden; border-radius:3px; background:var(--ui-border); }
.cw-progress > span { display:block; height:100%; border-radius:inherit; background:var(--ui-accent); transition:width .25s; }
.cw-outline-message { display:flex; flex-direction:column; align-items:flex-start; gap:15px; padding:24px 8px; color:var(--ui-text-muted); font-size:12px; line-height:1.7; }
.cw-document { position:relative; display:flex; flex-direction:column; min-width:0; min-height:0; overflow:hidden; background:var(--ui-surface); }
.cw-document-top { flex:none; display:none; align-items:center; justify-content:space-between; gap:12px; min-height:65px; padding:13px 24px; border-bottom:1px solid var(--ui-border); }
.cw-breadcrumb { display:block; min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:var(--ui-text-muted); font-size:11px; line-height:1.5; }
.cw-breadcrumb > .icon { flex:none; width:13px; height:13px; }
.cw-breadcrumb > span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.cw-document-actions { display:flex; align-items:center; flex:none; gap:10px; }
.cw-toolbar-row { position:relative; display:flex; flex:none; min-width:0; border-bottom:1px solid var(--ui-border); }
.cw-toolbar { position:relative; flex:1; min-width:0; display:flex; align-items:center; flex-wrap:nowrap; gap:4px; min-height:53px; padding:8px 20px; overflow-x:auto; overflow-y:hidden; background:var(--ui-surface); scrollbar-width:thin; scrollbar-color:var(--ui-border-strong) transparent; }
.cw-fullscreen-toggle { --ui-button-radius:0px; display:none; }
.cw-toolbar-group { display:flex; align-items:center; flex:none; gap:1px; padding-right:6px; }
.cw-toolbar-group + .cw-toolbar-group { padding-left:6px; border-left:1px solid var(--ui-border); }
.cw-page .cw-tool { display:inline-flex; align-items:center; justify-content:center; flex:none; min-width:31px; width:31px; height:32px; padding:6px; border:0; border-radius:var(--ui-button-radius,12px); background:transparent; color:var(--ui-text-secondary); font-size:13px; line-height:1; }
.cw-page .cw-tool .icon { width:16px; height:16px; }
.cw-page .cw-tool:hover { background:var(--ui-surface-muted); color:var(--ui-text); }
.cw-page .cw-tool.is-active, .cw-page .cw-tool[aria-pressed="true"] { background:var(--ui-accent-soft); color:var(--ui-accent); }
.cw-page .cw-tool:disabled { cursor:default; opacity:.3; }
.cw-format-trigger.single-trigger { flex:none; width:132px; min-width:132px; height:32px; min-height:32px; gap:14px; padding:6px 12px; border-color:transparent; background:transparent; font-size:12px; line-height:1.5; }
/* Text style is a toolbar label, not an outlined form field. */
.cw-page .cw-toolbar .cw-format-trigger.single-trigger { --field-focus-color:transparent; --field-focus-shadow:none; --field-focus-outline:none; border:0; background:transparent; box-shadow:none; outline:none; }
.cw-format-trigger:focus-visible .cw-format-label { text-decoration:underline; text-underline-offset:4px; }
.cw-format-label { flex:1; min-width:0; white-space:nowrap; text-align:left; }
.cw-format-trigger > .icon { width:16px; height:16px; margin:0; flex:none; }
.cw-editor-scroll { flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:var(--ui-border-strong) transparent; scroll-padding-block:35px; }
.cw-paper { max-width:820px; min-height:100%; margin:0 auto; padding:45px clamp(25px,4vw,68px) 85px; }
.cw-paper-meta { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:20px; }
.cw-paper-meta .cw-kicker { margin:0; }
.cw-status-control { flex:none; max-width:100%; margin-left:auto; }
.cw-status-trigger.single-trigger { width:auto; min-width:166px; max-width:100%; height:36px; min-height:36px; gap:14px; padding:8px 12px; font-size:12px; line-height:1.5; }
.cw-status-label { min-width:0; white-space:nowrap; }
.cw-status-trigger > .icon { width:16px; height:16px; margin:0; flex:none; }
.cw-status-options.single-options, .cw-format-options.single-options { position:fixed; right:auto; bottom:auto; z-index:300; width:210px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); margin:0; padding:6px; border-color:var(--ui-border-floating); background:var(--ui-surface-floating); box-shadow:var(--ui-shadow-floating); }
.cw-status-options .single-option, .cw-format-options .single-option { gap:10px; min-height:40px; padding:10px; font-size:12px; }
.cw-status-options .single-option-label { display:flex; align-items:center; gap:9px; }
.cw-status-options .cw-status-dot { width:6px; height:6px; }
.cw-kicker { display:flex; align-items:center; gap:7px; margin-bottom:15px; color:var(--ui-accent); font-size:10px; font-weight:650; line-height:1.5; letter-spacing:.09em; text-transform:uppercase; }
.cw-kicker .icon { width:14px; height:14px; }
.cw-page textarea.cw-title { display:block; width:100%; min-height:47px; margin:0 0 25px; padding:0 0 6px; overflow:hidden; resize:none; border:1px solid transparent; border-radius:0; background:transparent; color:var(--ui-text); font-size:clamp(25px,2.45vw,34px); font-weight:650; line-height:1.3; letter-spacing:-.045em; overflow-wrap:anywhere; }
.cw-page textarea.cw-title::placeholder { color:var(--ui-text-muted); }
.cw-editor { min-width:0; }
.cw-editor .tiptap { min-height:320px; outline:none; font-size:15px; line-height:1.85; color:var(--ui-text-secondary); overflow-wrap:break-word; }
.cw-editor .tiptap > :first-child { margin-top:0; }
.cw-editor .tiptap > :last-child { margin-bottom:0; }
.cw-editor .tiptap p { margin:0 0 18px; }
.cw-editor .tiptap h1, .cw-editor .tiptap h2, .cw-editor .tiptap h3 { margin:32px 0 14px; color:var(--ui-text); font-weight:650; line-height:1.35; letter-spacing:-.035em; }
.cw-editor .tiptap h1 { font-size:28px; }
.cw-editor .tiptap h2 { font-size:23px; }
.cw-editor .tiptap h3 { font-size:18px; }
.cw-editor .tiptap strong { color:var(--ui-text); font-weight:650; }
.cw-editor .tiptap a { color:var(--ui-accent); text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
.cw-editor .tiptap ul, .cw-editor .tiptap ol { padding-left:24px; margin:14px 0 20px; }
.cw-editor .tiptap li { padding-left:3px; margin:6px 0; }
.cw-editor .tiptap li p { margin:0 0 6px; }
.cw-editor .tiptap ul li::marker, .cw-editor .tiptap ol li::marker { color:var(--ui-text-muted); }
.cw-editor .tiptap blockquote { margin:24px 0; border-left:3px solid var(--ui-accent); padding:5px 0 5px 19px; color:var(--ui-text-secondary); }
.cw-editor .tiptap blockquote > :last-child { margin-bottom:0; }
.cw-editor .tiptap code { border-radius:4px; padding:2px 5px; background:var(--ui-surface-muted); font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace; font-size:.88em; color:var(--ui-text); }
.cw-editor .tiptap pre { margin:24px 0; padding:21px 23px; border:1px solid var(--ui-border); border-radius:12px; background:var(--ui-surface-muted); color:var(--ui-text-secondary); overflow-x:auto; white-space:pre-wrap; overflow-wrap:anywhere; tab-size:2; }
.cw-editor .tiptap pre code { padding:0; border-radius:0; background:transparent; color:inherit; font-size:12px; line-height:1.8; }
.cw-editor .tiptap hr { margin:32px 0; border:0; border-top:1px solid var(--ui-border-strong); }
.cw-editor .tiptap mark { border-radius:3px; background:#f2dcff; color:#493254; padding:1px 2px; }
.cw-editor .tiptap .tableWrapper { width:100%; overflow-x:auto; margin:22px 0; }
.cw-editor .tiptap table { width:100%; table-layout:fixed; border-collapse:collapse; margin:18px 0; overflow:hidden; }
.cw-editor .tiptap table td, .cw-editor .tiptap table th { position:relative; min-width:90px; padding:10px 12px; border:1px solid var(--ui-border-strong); vertical-align:top; font-size:13px; line-height:1.65; }
.cw-editor .tiptap table th { font-weight:650; background:var(--ui-surface-muted); color:var(--ui-text); text-align:left; }
.cw-editor .tiptap table p { margin:0; }
.cw-editor .tiptap .selectedCell::after { position:absolute; inset:0; z-index:2; background:var(--ui-accent-soft); opacity:.65; content:""; pointer-events:none; }
.cw-editor .tiptap .column-resize-handle { position:absolute; top:0; right:-2px; bottom:0; z-index:3; width:4px; background:var(--ui-accent); pointer-events:none; }
.cw-editor .tiptap.resize-cursor { cursor:col-resize; }
.cw-editor .tiptap p.is-editor-empty:first-child::before { content:attr(data-placeholder); float:left; color:var(--ui-text-muted); pointer-events:none; height:0; }
.cw-notice { display:flex; align-items:center; justify-content:space-between; flex:none; gap:14px; padding:13px 22px; border-bottom:1px solid var(--ui-border); background:var(--ui-warning-soft); color:var(--ui-warning); }
.cw-notice-copy { flex:1; min-width:0; font-size:11px; line-height:1.6; }
.cw-notice-copy strong { display:block; font-weight:650; }
.cw-notice-copy p { margin:3px 0 0; }
.cw-notice-actions { display:flex; flex:none; flex-wrap:wrap; align-items:center; gap:7px; }
.cw-notice .button { min-height:33px; padding:7px 10px; font-size:10px; }
.cw-empty { display:flex; flex:1; flex-direction:column; align-items:center; justify-content:center; min-height:280px; padding:45px 28px; text-align:center; }
.cw-empty-icon { display:grid; place-items:center; width:58px; height:58px; margin-bottom:20px; border:1px solid var(--ui-border); border-radius:17px; background:var(--ui-surface-muted); color:var(--ui-accent); }
.cw-empty-icon .icon { width:25px; height:25px; }
.cw-empty h2, .cw-empty h3 { max-width:380px; margin:0 0 9px; font-size:22px; font-weight:600; line-height:1.3; letter-spacing:-.04em; }
.cw-empty p { max-width:325px; margin:0 0 23px; color:var(--ui-text-muted); font-size:12px; line-height:1.75; }
.cw-outline .cw-empty { padding:30px 12px; min-height:160px; }
.cw-outline .cw-empty h3 { font-size:15px; }
.cw-outline .cw-empty p { margin-bottom:12px; font-size:11px; }
.cw-inline-title { flex:1; min-width:0; }
.cw-inline-title input, input.cw-inline-title { width:100%; min-width:0; padding:7px 8px; border:1px solid var(--ui-border); border-radius:8px; background:var(--ui-input); color:var(--ui-text); font-size:12px; }
.cw-menu { position:fixed; z-index:300; width:196px; max-height:calc(100dvh - 24px); overflow:auto; padding:6px; border:1px solid var(--ui-border-floating); border-radius:13px; background:var(--ui-surface-floating); color:var(--ui-text); box-shadow:var(--ui-shadow-floating); }
.cw-menu button { display:flex; align-items:center; gap:9px; width:100%; min-height:35px; padding:8px 9px; border:0; border-radius:var(--ui-button-radius,12px); background:transparent; color:var(--ui-text-secondary); text-align:left; font-size:11px; }
.cw-menu button:hover { background:var(--ui-surface-floating-hover); color:var(--ui-text); }
.cw-menu button .icon { width:14px; height:14px; }
.cw-menu button.is-danger, .cw-menu button[data-danger="true"], .cw-menu button[data-cw-action^="delete-"] { color:var(--ui-danger); }
.cw-menu hr, .cw-menu-divider { margin:5px 3px; border:0; border-top:1px solid var(--ui-border); }
.cw-dialog-overlay { position:fixed; inset:0; z-index:500; display:flex; align-items:center; justify-content:center; padding:24px; background:rgb(25 19 32 / .4); backdrop-filter:blur(5px); }
.cw-dialog { width:100%; max-width:430px; max-height:calc(100dvh - 48px); overflow:auto; padding:24px; border:1px solid var(--ui-border-floating); border-radius:20px; background:var(--ui-surface-floating); color:var(--ui-text); box-shadow:var(--ui-shadow-floating); }
.cw-dialog header, .cw-dialog-header { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:20px; }
.cw-dialog h2 { margin:0; font-size:20px; font-weight:650; line-height:1.35; letter-spacing:-.035em; }
.cw-dialog p { margin:0 0 20px; color:var(--ui-text-secondary); font-size:13px; line-height:1.7; overflow-wrap:anywhere; }
.cw-dialog label { display:block; margin-bottom:8px; color:var(--ui-text-secondary); font-size:12px; font-weight:600; }
.cw-dialog input, .cw-dialog select, .cw-dialog textarea { width:100%; min-height:43px; padding:11px 12px; border:1px solid var(--ui-border-strong); border-radius:10px; background:var(--ui-input); color:var(--ui-text); font-size:13px; }
.cw-dialog textarea { min-height:130px; resize:vertical; }
.cw-dialog-actions, .cw-dialog form > footer { display:flex; justify-content:flex-end; align-items:center; gap:9px; margin-top:23px; }
.cw-dialog-field input, .cw-dialog-field select, .cw-dialog-field textarea { display:block; margin-top:9px; font-weight:400; }
.cw-dialog .cw-dialog-help { margin:9px 0 0; font-size:11px; color:var(--ui-text-muted); }
.cw-dialog .cw-dialog-error { margin:10px 0 0; color:var(--ui-danger); font-size:12px; }
.cw-dialog-error:empty { display:none; }
.cw-compare-dialog { max-width:790px; }
.cw-compare { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin:0 0 23px; }
.cw-compare section { min-width:0; padding:15px; border:1px solid var(--ui-border); border-radius:12px; background:var(--ui-surface-muted); }
.cw-compare h3 { margin:0 0 12px; color:var(--ui-text-muted); font-size:11px; font-weight:600; }
.cw-compare strong { display:block; font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
.cw-compare pre { max-height:260px; margin:14px 0 0; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; font-family:inherit; font-size:12px; line-height:1.7; color:var(--ui-text-secondary); }
.cw-mobile-only, .cw-page [data-mobile-only] { display:none!important; }
.cw-outline-backdrop { display:none; }
html[data-theme="dark"] .cw-shell { box-shadow:none; }
html[data-theme="dark"] .cw-dialog-overlay { background:rgb(4 3 8 / .65); }
@media (hover:hover) and (pointer:fine) {
  .cw-module-actions, .cw-lesson-actions { opacity:0; transition:opacity .13s; }
  .cw-module-header:hover .cw-module-actions, .cw-module-header:focus-within .cw-module-actions,
  .cw-lesson:hover .cw-lesson-actions, .cw-lesson:focus-within .cw-lesson-actions,
  .cw-lesson.is-selected .cw-lesson-actions { opacity:1; }
}
@media (max-width:1350px) {
  .cw-page { --cw-outline-width:253px; }
  .cw-document-top { padding-inline:19px; gap:8px; }
  .cw-document-actions { gap:6px; }
  .cw-toolbar { padding-inline:14px; }
  .cw-paper { padding-inline:35px; }
}
@media (max-width:1100px) {
  .cw-shell { grid-template-columns:minmax(0,1fr); }
  .cw-mobile-only, .cw-page [data-mobile-only] { display:inline-flex!important; }
  .cw-outline { position:absolute; inset:0 auto 0 0; z-index:40; width:min(320px,calc(100% - 38px)); transform:translateX(-105%); visibility:hidden; transition:transform .22s,visibility .22s; border-right:1px solid var(--ui-border-strong); box-shadow:12px 0 40px rgb(25 19 32 / .12); }
  .cw-page.is-outline-open .cw-outline { display:flex; visibility:visible; transform:translateX(0); }
  .cw-outline-backdrop { position:absolute; inset:0; z-index:35; border:0; padding:0; background:rgb(25 19 32 / .26); backdrop-filter:blur(2px); }
  .cw-page.is-outline-open .cw-outline-backdrop { display:block; }
  .cw-breadcrumb { flex:1; }
  .cw-document-top { display:flex; gap:9px; }
  .cw-paper { max-width:780px; padding-inline:45px; }
}
@media (max-width:760px) {
  html:has(.workspace-course-writing), body:has(.workspace-course-writing) { overflow:hidden; }
  html:has(.workspace-course-writing) { scrollbar-gutter:auto; }
  .workspace-course-writing { display:flex; flex-direction:column; height:100dvh; min-height:0; overflow:hidden; }
  .workspace-course-writing .sidebar { position:relative; top:auto; flex:none; align-self:stretch; width:100%; height:auto; min-height:0; }
  .workspace-course-writing .main { flex:1 1 0; height:auto; min-height:0; margin:0; padding-inline:0; padding-bottom:var(--workspace-bottom-nav,68px); overflow:hidden; }
  .cw-page { --cw-mobile-left:max(var(--admin-main-inline,19px),env(safe-area-inset-left,0px)); --cw-mobile-right:max(var(--admin-main-inline,19px),env(safe-area-inset-right,0px)); display:flex; flex-direction:column; flex:1; min-height:0; }
  .cw-page-heading { flex-wrap:wrap; gap:12px; margin:0 var(--cw-mobile-right) 20px var(--cw-mobile-left); }
  .cw-page-heading h1 { font-size:28px; }
  .cw-page-actions { padding:0; }
  .cw-page-actions .button { padding:10px 12px; }
  /* Full-width writing surface. Only the text area scrolls vertically. */
  .cw-shell { flex:1; height:auto; min-height:0; max-height:none; overflow:hidden; border-radius:0; background:transparent; isolation:auto; }
  .cw-mobile-navigation { display:flex; flex:none; align-items:center; gap:10px; min-width:0; min-height:52px; margin:0 var(--cw-mobile-right) 14px var(--cw-mobile-left); padding:4px 12px; border-radius:16px; background:var(--ui-surface); }
  .cw-mobile-breadcrumb { flex:1; min-width:0; color:var(--ui-text-secondary); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
  .cw-document { overflow:hidden; background:transparent; }
  .cw-editor-scroll { flex:1; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  html[data-mobile-keyboard] .workspace-course-writing { height:var(--mobile-viewport-height,100dvh); }
  html[data-mobile-keyboard] .workspace-course-writing .main { padding-top:8px; padding-bottom:env(safe-area-inset-bottom,0px); }
  html[data-mobile-keyboard] .workspace-course-writing .cw-page-heading { display:none; }
  .cw-document-top { display:none; }
  .cw-document-actions { gap:3px; }
  .cw-breadcrumb { font-size:10px; gap:4px; }
  .cw-breadcrumb > .icon { width:11px; height:11px; }
  .cw-toolbar-row { border-top:1px solid var(--ui-border); }
  .cw-toolbar { min-height:54px; padding:5px var(--cw-mobile-right) 5px var(--cw-mobile-left); gap:0; background:transparent; scrollbar-width:none; -ms-overflow-style:none; }
  .cw-toolbar::-webkit-scrollbar { display:none; height:0; }
  /* This sibling stays at the right edge while the formatting controls scroll. */
  .cw-fullscreen-toggle { display:flex; flex:none; align-items:center; justify-content:center; align-self:stretch; width:calc(52px + env(safe-area-inset-right,0px)); min-height:44px; padding:0 env(safe-area-inset-right,0px) 0 0; border:0; border-radius:0; background:var(--ui-surface-raised); color:var(--ui-text-secondary); cursor:pointer; }
  .cw-fullscreen-toggle > .icon { width:20px; height:20px; }
  .cw-fullscreen-toggle:hover, .cw-fullscreen-toggle:active { background:var(--ui-surface-hover); color:var(--ui-text); }
  .cw-page .cw-fullscreen-toggle:focus-visible { outline-offset:-3px; }
  /* Full screen remains inside the app viewport, including the iPhone keyboard. */
  .workspace-course-writing:has(.cw-page.is-mobile-fullscreen) .sidebar { display:none; }
  .workspace-course-writing:has(.cw-page.is-mobile-fullscreen) .main { padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px); }
  .cw-page.is-mobile-fullscreen > .cw-page-heading, .cw-page.is-mobile-fullscreen > .cw-mobile-navigation { display:none; }
  .cw-toolbar-group { padding-right:4px; }
  .cw-toolbar-group + .cw-toolbar-group { padding-left:4px; }
  .cw-format-trigger.single-trigger { width:144px; min-width:144px; min-height:44px; font-size:14px; }
  .cw-page .cw-tool { width:37px; min-width:37px; height:40px; }
  .cw-page .icon-button { width:38px; height:38px; min-height:38px; padding:10px; }
  /* Match the workspace menu's edge, scrim and motion, opening from the left. */
  .cw-outline { position:fixed; inset:0 auto var(--workspace-bottom-nav,68px) 0; z-index:42; width:min(82vw,360px); padding:calc(26px + env(safe-area-inset-top,0px)) 14px 0 max(14px,env(safe-area-inset-left,0px)); border:0; border-radius:0; box-shadow:none; overflow:hidden; transform:translateX(-100%); transition:none; }
  .cw-outline-backdrop { position:fixed; inset:0 0 var(--workspace-bottom-nav,68px); z-index:41; background:rgb(12 9 18 / .38); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); touch-action:none; }
  .cw-page.is-outline-open .cw-outline { animation:cw-outline-in .22s cubic-bezier(.2,.7,.2,1); }
  .cw-page.is-outline-open .cw-outline-backdrop { animation:cw-backdrop-in .18s ease-out; }
  .cw-page[data-outline-closing="true"] .cw-outline { pointer-events:none; animation:cw-outline-out .22s cubic-bezier(.4,0,.6,1) forwards; }
  .cw-page[data-outline-closing="true"] .cw-outline-backdrop { pointer-events:none; animation:cw-backdrop-out .22s ease-out forwards; }
  .cw-outline-heading h2, .cw-outline-heading > span { font-size:14px; }
  .cw-module-actions, .cw-lesson-actions { opacity:1; }
  .cw-module-actions .icon-button, .cw-lesson-actions .icon-button { width:32px; height:36px; min-height:36px; padding:8px; }
  .cw-module-toggle { min-height:40px; }
  .cw-lesson-main { padding-block:15px; }
  .cw-lesson-title { font-size:13px; }
  .cw-lesson-actions { padding-top:10px; }
  .cw-module-add { min-height:42px; }
  .cw-add-module { min-height:44px; font-size:13px; }
  .cw-status-trigger.single-trigger { min-height:44px; font-size:13px; }
  .cw-status-options .single-option, .cw-format-options .single-option { min-height:44px; font-size:13px; }
  .cw-paper { width:100%; max-width:none; min-height:0; padding:30px var(--cw-mobile-right) 55px var(--cw-mobile-left); }
  .cw-kicker { font-size:9px; margin-bottom:12px; }
  .cw-page textarea.cw-title { font-size:27px; margin-bottom:23px; letter-spacing:-.04em; }
  .cw-editor .tiptap { font-size:15px; line-height:1.85; }
  .cw-editor .tiptap h1 { font-size:25px; }
  .cw-editor .tiptap h2 { font-size:21px; }
  .cw-editor .tiptap h3 { font-size:18px; }
  .cw-editor .tiptap pre { padding:17px; }
  .cw-notice { align-items:flex-start; flex-direction:column; gap:9px; padding:12px 16px; }
  .cw-notice-actions { align-self:flex-end; }
  .cw-notice .button { min-height:37px; }
  .cw-dialog-overlay { padding:16px; }
  .cw-dialog { padding:22px; max-height:calc(100dvh - 32px); }
  .cw-dialog input, .cw-dialog select, .cw-dialog textarea { font-size:16px; }
  .cw-compare { grid-template-columns:minmax(0,1fr); }
  .cw-compare pre { max-height:150px; }
}
@media (max-width:430px) {
  .cw-page-heading { gap:9px; }
  .cw-page-heading h1 { font-size:25px; }
  .cw-page-actions { gap:5px; }
  .cw-page-actions .button { min-height:37px; padding:9px 10px; font-size:11px; }
  .cw-page-actions .button .icon { width:14px; height:14px; }
  .cw-paper { padding-top:26px; }
  .cw-page textarea.cw-title { font-size:25px; }
  .cw-document-top { padding-inline:7px; }
  .cw-document-actions .icon-button { width:34px; min-width:34px; padding:8px; }
  .cw-breadcrumb { max-width:95px; }
  .cw-notice-actions { align-self:stretch; }
  .cw-notice-actions .button { flex:1; }
}
@keyframes cw-outline-in { from { transform:translateX(-100%); } to { transform:translateX(0); } }
@keyframes cw-outline-out { from { transform:translateX(0); } to { transform:translateX(-100%); } }
@keyframes cw-backdrop-in { from { opacity:0; } to { opacity:1; } }
@keyframes cw-backdrop-out { from { opacity:1; } to { opacity:0; } }
@media (pointer:coarse) {
  .cw-page .cw-tool { width:44px; min-width:44px; height:44px; }
  .cw-page .icon-button { min-width:44px; min-height:44px; }
  .cw-module-toggle, .cw-module-add, .cw-add-module, .cw-menu button, .cw-status-options .single-option, .cw-format-options .single-option { min-height:44px; }
  .cw-format-trigger.single-trigger, .cw-status-trigger.single-trigger { min-height:44px; }
}
@media (max-width:760px), (pointer:coarse) {
  .cw-page input, .cw-page select { font-size:16px; }
}
@media (prefers-reduced-motion:reduce) {
  .cw-page *, .cw-page *::before, .cw-page *::after { transition:none!important; animation:none!important; scroll-behavior:auto!important; }
}

/* Mobile course navigation opens below its field, without shifting the editor. */
@media (max-width:760px) {
 .cw-outline-trigger { display:flex; align-items:center; gap:12px; flex:1; min-width:0; min-height:44px; padding:4px 8px; border:0; background:transparent; color:var(--ui-text-secondary); text-align:left; }
 .cw-outline-trigger > .icon { flex:none; width:17px; height:17px; transition:transform .18s; }
 .cw-outline-trigger[aria-expanded="true"] > .icon { transform:rotate(180deg); }
 .cw-page.is-outline-open .cw-mobile-navigation { position:relative; z-index:43; }
 .cw-page .cw-outline { inset:auto; top:var(--cw-dropdown-top); left:var(--cw-dropdown-left); width:var(--cw-dropdown-width); max-height:calc(100dvh - var(--cw-dropdown-top) - var(--workspace-bottom-nav,68px) - 12px); padding:16px 10px 0; border:1px solid var(--ui-border-floating); border-radius:16px; box-shadow:var(--ui-shadow-floating); transform:none; z-index:44; }
 .cw-page.is-outline-open .cw-outline { animation:cw-dropdown-in .16s ease-out; }
 .cw-page .cw-outline-backdrop { background:transparent; backdrop-filter:none; -webkit-backdrop-filter:none; animation:none; }
 .cw-outline-footer { display:none; }
 .cw-outline-list { flex:1 1 auto; padding-top:12px; }
}
@keyframes cw-dropdown-in { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }
