/* The newsletter uses the available workspace; other administration pages retain their layout. */
body.admin-workspace-page:has(#editor:not([hidden]) #panel-newsletter:not([hidden])) {
  & .editor-shell{display:flex;flex-direction:column;align-items:stretch;height:100dvh;min-height:0}
  & #editor{min-height:0}
  & .editor-sidebar{position:relative;inset:auto;align-self:stretch;display:flex;flex-direction:row;align-items:center;gap:24px;flex:0 0 64px;height:64px;min-height:0;overflow:visible;padding:0 28px;background:#fff;border:0;border-bottom:1px solid var(--line);z-index:10}
  & .editor-header{padding:0;flex-shrink:0}
  & .editor-brand{gap:10px}
  & .editor-brand>img{width:28px;height:34px}
  & .editor-brand strong{font-size:14px}
  & .chapter-identity{display:flex;align-items:center;gap:6px;font-size:10px;margin-top:1px}
  & #editor-environment{position:static;flex-shrink:0;font-size:9px;margin:0}
  & .editor-section-nav{display:none}
  & .newsletter-back{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;min-height:44px;padding:8px 10px;border-radius:8px;color:var(--ink);font-size:13px;text-decoration:none}
  & .newsletter-back:hover{background:#f0f3f7}
  & .newsletter-back[aria-disabled=true]{opacity:.5;cursor:wait}
  & .newsletter-back svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
  & .workspace-account{position:static;display:flex;gap:10px;max-width:32%;margin:0 0 0 auto;padding:0;border:0}
  & .workspace-account>div{display:block}
  & .account-avatar{display:none}
  & .workspace-account .account-name{font-size:12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  & .workspace-account [data-account-role]{font-size:11px}
  & #sign-out{min-height:44px}
  & .editor-content-pane{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;padding:0}
  & .editor-content-pane>*{width:100%;max-width:none;margin-inline:0}
  & #editor-message:not(:empty),& #newsletter-message:not(:empty){flex-shrink:0;margin:10px 24px;padding:10px 16px;width:auto}
  & #website-reload:empty{display:none}
  & #editor-notice-message{white-space:pre-line}
}

#panel-newsletter {
  &{display:flex;flex:1;flex-direction:column;min-height:0;background:#f8f9fb}
  &>.section-heading{margin:0}
  & #reload-issue{align-self:flex-start;margin:0 24px 8px}
  & .issue-library{flex-shrink:0;display:flex;flex-wrap:nowrap;align-items:center;gap:14px;padding:18px 28px;margin:0;background:#fcfcfd}
  & #open-newsletter-library{display:flex;align-items:center;justify-content:center;gap:6px;flex-shrink:0;min-width:40px;height:44px;padding:8px 10px;font-size:12px}
  & #open-newsletter-library svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
  & #newsletter-current-edition{font-size:23px;line-height:1.3;letter-spacing:-.5px;font-weight:650;margin:0;overflow-wrap:anywhere}
  & .issue-picker{position:absolute;width:1px;height:1px;min-width:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  & .issue-badge{display:inline-block;flex-shrink:0;padding:4px 8px;font-size:11px}
  & .library-actions{display:none}
  & #newsletter-form{display:flex;flex-direction:column;flex:1;min-height:0;margin:0}
  & .newsletter-toolbar{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:0 28px 16px;flex-shrink:0;background:#fcfcfd;border-bottom:1px solid var(--line)}
  & .newsletter-modes{position:static;flex-shrink:0;width:auto;display:inline-flex;border:0;padding:3px;gap:3px;background:#e9edf2;border-radius:9px}
  & .newsletter-modes button{padding:8px 18px;min-height:40px;font-size:12px;white-space:nowrap}
  & .newsletter-modes #view-review{margin-left:5px;background:var(--blue);color:#fff;box-shadow:none}
  & .newsletter-modes #view-review:hover{background:#005bbb}
  & .newsletter-modes #view-review[aria-selected=true]{background:#164f95}
  & .newsletter-save-bar{position:static;display:flex;align-items:center;justify-content:flex-end;gap:18px;margin:0;padding:0;min-width:0;border:0;border-radius:0;background:transparent;box-shadow:none;backdrop-filter:none}
  & #newsletter-status{font-size:12px;max-width:320px;width:auto;margin:0;text-align:right;overflow-wrap:anywhere}
  & .newsletter-save-bar .save-actions{width:auto;gap:8px;flex-wrap:nowrap}
  & .newsletter-save-bar .save-actions:has(#cancel-newsletter-upload:not([hidden])) > :not(#cancel-newsletter-upload){display:none}
  & .newsletter-save-bar button{font-size:12px;min-height:42px;padding:9px 13px}
  & #next-step{display:none}
  & .newsletter-layout{flex:1;min-height:0;min-width:0;padding:0}
  & .newsletter-layout[data-view=write]{display:grid;grid-template-columns:minmax(0,1.22fr) minmax(0,1fr)}
  & #write-pane{min-height:0;min-width:0;overflow:hidden}
  & #newsletter-fields{display:grid;grid-template-columns:220px minmax(0,1fr);gap:0;justify-content:stretch;height:100%;min-height:0}
  & .composer-sidebar{position:relative;inset:auto;align-self:stretch;display:flex;flex-direction:column;gap:0;min-height:0;min-width:0;padding:24px 15px 18px 20px;background:#fafbfc;border-right:1px solid var(--line);overflow:hidden}
  & .outline-heading{padding:0 8px;margin:0 0 17px;flex-shrink:0}
  & .outline-heading h2{font-size:13px}
  & .outline-heading .hint{padding:2px 7px;background:#e9edf2;border-radius:5px}
  & #outline-toggle{display:none}
  & .newsletter-outline-group{display:flex;flex-direction:column;flex:1;min-height:0;gap:12px}
  & .outline-setting{display:flex;align-items:center;width:100%;min-height:48px;flex-shrink:0;padding:10px;border:1px solid transparent;border-radius:8px;background:transparent;color:#45566b;text-align:left;font-size:12px}
  & .outline-setting small{display:block;margin-top:4px;color:var(--muted);font-size:11px;font-weight:400}
  & .outline-setting:hover{background:#eef2f7}
  & .outline-setting[aria-current],& .outline-setting[aria-pressed=true],& .outline-setting.is-active{background:#edf4fd;border-color:#cee0f7;color:#005bbb}
  & #newsletter-outline{position:static;display:flex;flex:1;min-height:0;max-height:none;padding:12px 0;border-block:1px solid var(--line);gap:5px;overflow:auto;box-shadow:none;border-radius:0;background:transparent}
  & #newsletter-outline a{display:flex;min-height:62px;font-size:12px;padding:11px 8px;border:1px solid transparent;border-radius:8px}
  & #newsletter-outline a[aria-current=location]{color:#005bbb;background:#edf4fd;border-color:#cee0f7}
  & .outline-number{flex-basis:19px;font-size:11px;color:#546477}
  & .outline-thumbnail{display:flex;align-items:center;justify-content:center;flex:0 0 34px;width:34px;height:40px;overflow:hidden;background:#fff;border:1px solid #dce2e9;border-radius:4px}
  & .outline-thumbnail img{display:block;width:100%;height:100%;object-fit:cover}
  & .outline-copy{display:flex;flex:1;flex-direction:column;gap:4px;min-width:0}
  & .outline-kind{font-size:11px;font-weight:400;color:#637184}
  & .outline-title{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.4}
  & .insert-content{flex-shrink:0;margin:15px 0 0}
  & #add-content{width:100%;min-height:44px;border-style:dashed;border-color:#b7c8dc;background:transparent;font-size:12px}
  & .outline-help{padding:12px 8px 0;margin:0;font-size:11px;line-height:1.6}
  & .composer-document{min-height:0;overflow:auto;overscroll-behavior:contain;background:#fff;border:0;border-radius:0;box-shadow:none;padding:0 0 32px}
  & .document-masthead{display:none}
  & .document-settings,& .document-footer{margin:0;padding:28px clamp(24px,2.5vw,48px);border:0;background:transparent}
  & .document-settings>summary,& .document-footer>summary{font-size:20px;font-weight:600;color:var(--ink);padding:0;margin:0 0 20px;min-height:30px;list-style:none;cursor:default}
  & .document-settings>summary::-webkit-details-marker,& .document-footer>summary::-webkit-details-marker{display:none}
  & .document-settings .form-grid{gap:24px;padding:0}
  & .lead-block,& .composer-document .content-block{padding:28px clamp(24px,2.5vw,48px);border-top:0;scroll-margin-top:0}
  & .content-block[data-kind=callout]{border-left:0;background:transparent}
  & .block-toolbar{flex-wrap:wrap;gap:12px;margin-bottom:26px}
  & .block-toolbar h2{font-size:19px;letter-spacing:-.35px;min-width:90px;color:var(--ink)}
  & .block-toolbar .drag-handle{display:none}
  & .block-actions{margin-left:auto}
  & .block-toolbar button{min-width:32px;min-height:40px;padding:7px 5px;font-size:12px}
  & .block-fields{gap:22px}
  & .field>label{color:#425265;font-size:13px;font-weight:550}
  & input,& textarea,& select{border-radius:7px}
  & #nl-lead-title{font:600 23px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;min-height:55px;color:var(--ink)}
  & .rich-editor.ql-container{font-size:15px;line-height:1.7}
  & .ql-editor{min-height:230px}
  & .image-preview{max-height:340px;border:1px solid var(--line);border-radius:8px;background:#f5f7fa}
  & .newsletter-empty{padding:65px 32px;text-align:center;max-width:490px;margin:auto}
  & .newsletter-empty h2{font-size:23px;margin-bottom:12px}
  & .newsletter-empty p{font-size:14px;color:var(--muted);line-height:1.7}
  & .newsletter-empty .add-content-bottom{width:auto;margin:24px auto 0;padding-inline:22px;border-radius:8px;font-size:13px}
  & #preview-pane{display:flex;flex-direction:column;height:100%;min-height:0;min-width:0;overflow:hidden;background:#edf0f4;border-left:1px solid var(--line);padding:20px 24px 0}
  & .preview-heading{flex-shrink:0;align-items:center;width:100%;max-width:none;margin:0 0 10px;gap:10px}
  & .preview-heading h2{font-size:13px;letter-spacing:0;margin:0}
  & #preview-status{font-size:11px;margin-top:4px}
  & #newsletter-preview-expand{font-size:11px;min-height:40px;padding:8px}
  & .preview-controls{flex-shrink:0;align-items:center;justify-content:space-between;gap:10px;width:100%;margin-bottom:12px}
  & .preview-format-field{min-width:130px;max-width:190px;flex:1}
  & .preview-format-field select{font-size:12px;min-height:40px;padding:8px 10px;background:#fff;border-color:#d4dce5}
  & .preview-devices{padding:3px;background:#e0e5eb;gap:2px}
  & .preview-devices button{min-height:36px;padding:6px 10px;font-size:11px;border-radius:5px}
  & .preview-format-note{flex-shrink:0;width:100%;max-width:none;margin:0 0 10px;font-size:11px;line-height:1.5}
  & .preview-stage{display:flex;flex-direction:column;align-items:center;flex:1;min-height:0;min-width:0;width:100%;max-width:none;margin:0;padding:0;overflow:hidden;background:transparent;border:0;border-radius:0}
  & .email-preview-header{flex-shrink:0;width:100%;max-width:720px;margin:0;padding:12px 16px;border:1px solid #dbe2e9;border-bottom:0}
  & #email-preview-subject{font-size:13px}
  & #email-preview-preheader{font-size:12px}
  & #newsletter-preview{display:block;flex:1;width:100%;max-width:720px;height:100%;min-height:0;margin:0;border:1px solid #dbe2e9;border-radius:3px 3px 0 0;box-shadow:0 5px 22px #243b5315}
  & .preview-stage[data-device=mobile] #newsletter-preview,& .preview-stage[data-device=mobile] .email-preview-header{width:375px;max-width:100%}
  & .preview-bottom{flex-shrink:0;justify-content:center;max-width:none;margin:0;padding:9px 0;min-height:29px}
  & .preview-bottom .hint{font-size:10px}
  & #review-pane{height:100%;overflow:auto;padding:34px 28px 60px;overscroll-behavior:contain}
  & .review-heading,& .review-layout{max-width:1000px}
  & #content-picker-dialog{width:min(610px,calc(100% - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:26px}
  & #content-picker{position:static;inset:auto;display:grid;grid-template-columns:1fr 1fr;width:100%;max-height:none;margin:20px 0 0;padding:0;gap:12px;border:0;border-radius:0;box-shadow:none;background:transparent;overflow:visible}
  & #content-picker button{padding:18px;min-height:98px;justify-content:center;gap:6px;border:1px solid var(--line);border-radius:10px;background:#fff}
  & #content-picker button:hover{border-color:#a9c8ec;background:#f4f8fe}
  & #content-picker strong{font-size:14px}
  & #content-picker span{font-size:12px;line-height:1.5}
  & #content-picker .image-link-choice{grid-column:1/-1;min-height:44px;padding:8px 12px;border:0;color:var(--blue);font-size:12px;align-items:center}
  & #newsletter-publication-receipt{flex-shrink:0;display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 28px 16px;padding:14px 16px;border:1px solid #c9ded2;border-radius:9px;background:#f1f8f3;font-size:13px;color:#265540}
  & #newsletter-publication-receipt p{flex:1;min-width:190px}
  & #newsletter-publication-receipt .receipt-links{display:flex;align-items:center;gap:18px;flex-wrap:wrap;margin-left:auto}
  & #newsletter-publication-receipt a{font-size:12px;min-height:40px;display:inline-flex;align-items:center}
  & #newsletter-publication-receipt button{font-size:12px;padding:8px 10px}
  & .newsletter-library-dialog{width:min(680px,calc(100% - 32px));max-height:85dvh;overflow:auto}
  & .newsletter-library-search{display:grid;gap:7px;margin:20px 0 14px}
  & .newsletter-library-status{font-size:12px;color:var(--muted);margin-block:12px}
  & .newsletter-library-list{list-style:none;margin:0;padding:0;max-height:45dvh;overflow:auto;border-block:1px solid var(--line)}
  & .newsletter-library-list>li+li{border-top:1px solid var(--line)}
  & .newsletter-library-issue{display:flex;align-items:center;justify-content:space-between;gap:14px;width:100%;padding:17px 12px;border:0;border-radius:6px;background:transparent;color:var(--ink);text-align:left}
  & .newsletter-library-issue:hover{background:#f1f6fd}
  & .newsletter-library-issue-copy{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}
  & .newsletter-library-edition{font-size:14px;font-weight:600}
  & .newsletter-library-subject{font-size:12px;font-weight:400;color:#506075}
  & .newsletter-library-date{font-size:11px;color:var(--muted);font-weight:400}
  & .newsletter-library-current{flex-shrink:0;border-radius:5px;background:#edf4fd;color:#165da4;font-size:10px;padding:4px 7px}
  & .newsletter-library-actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:22px}
  & #newsletter-library-more{margin-top:12px}
}

@media(min-width:1100px){body:has(#editor:not([hidden]) #panel-newsletter:not([hidden])){overflow:hidden}}
@media(min-width:1800px){#panel-newsletter #newsletter-fields{grid-template-columns:245px minmax(0,1fr)}}
@media(max-width:1290px) and (min-width:1100px){#panel-newsletter #newsletter-fields{grid-template-columns:195px minmax(0,1fr)}#panel-newsletter .composer-sidebar{padding-inline:12px}#panel-newsletter .preview-controls{flex-wrap:wrap}#panel-newsletter .block-toolbar{gap:6px}}
@media(max-width:1099px){
  body.admin-workspace-page:has(#editor:not([hidden]) #panel-newsletter:not([hidden])){& .workspace-account>div{display:none}& .editor-sidebar{padding-inline:20px;gap:18px}& .editor-section-nav{min-width:160px}}
  #panel-newsletter{
    & .newsletter-layout[data-view=write]{display:block}
    & #write-pane{height:100%}
    & #newsletter-fields{grid-template-columns:220px minmax(0,1fr)}
    & .newsletter-toolbar{gap:10px;padding-inline:20px}
    & .issue-library{padding-inline:20px}
    & .newsletter-save-bar{gap:10px}
    & #newsletter-status{max-width:150px;font-size:11px}
    & .newsletter-modes button{padding-inline:12px}
    & #preview-pane{border-left:0;padding-inline:max(20px,calc((100vw - 850px)/2))}
    & #newsletter-preview-expand{display:none}
  }
}
@media(max-width:740px){
  body.admin-workspace-page:has(#editor:not([hidden]) #panel-newsletter:not([hidden])){
    & .editor-shell{height:auto;min-height:100dvh}
    & .editor-sidebar{display:grid;grid-template-columns:minmax(0,1fr) auto;height:auto;flex-basis:auto;min-height:60px;padding:8px 14px;gap:4px 10px}
    & .editor-header{grid-column:1;grid-row:1}
    & .editor-brand>img{width:23px;height:29px}
    & .editor-brand strong{font-size:12px}
    & .chapter-identity{font-size:9px}
    & .newsletter-back{grid-column:1/-1;grid-row:2;justify-self:start;padding-inline:4px;font-size:12px}
    & .workspace-account{grid-column:2;grid-row:1;max-width:none;gap:0}
    & .workspace-account>div{display:none}
    & #sign-out{font-size:12px;padding-inline:6px}
  }
  #panel-newsletter{
    & .issue-library{padding:16px 14px;gap:10px;flex-wrap:wrap}
    & #newsletter-current-edition{font-size:20px;flex:1}
    & .library-actions{width:100%;margin:0}
    & .newsletter-toolbar{position:sticky;top:0;z-index:6;flex-direction:column;gap:10px;padding:0 14px 12px}
    & .newsletter-modes{display:flex;width:100%;position:static}
    & .newsletter-modes button{flex:1;min-height:40px;font-size:11px;padding-inline:8px}
    & .newsletter-save-bar{width:100%;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;gap:10px}
    & #newsletter-status{max-width:none;width:auto;text-align:left;font-size:11px}
    & .newsletter-save-bar .save-actions{width:auto;gap:6px}
    & .newsletter-save-bar button{font-size:11px;padding:8px 10px;min-height:40px}
    & #newsletter-fields{display:flex;flex-direction:column;height:auto;gap:0}
    & .composer-sidebar{position:relative;top:auto;display:grid;grid-template-columns:1fr auto;align-items:center;padding:12px 14px;gap:12px;overflow:visible;border-right:0;border-bottom:1px solid var(--line);z-index:5}
    & .outline-heading,& .outline-help{display:none}
    & #outline-toggle{display:flex;width:100%;justify-content:space-between;min-height:44px;padding:8px 12px;font-size:12px}
    & .insert-content{margin:0}
    & #add-content{width:auto;padding:8px 12px}
    & .newsletter-outline-group{display:none;position:absolute;top:100%;left:14px;right:14px;max-height:min(65dvh,500px);overflow:auto;padding:12px;background:#fff;border:1px solid var(--line);border-radius:0 0 10px 10px;box-shadow:0 12px 25px #213a5520}
    & .composer-sidebar:has(#outline-toggle[aria-expanded=true]) .newsletter-outline-group{display:flex}
    & #newsletter-outline{display:flex;flex:none;max-height:35dvh;overflow:auto}
    & .composer-document{overflow:visible;min-height:420px}
    & .document-settings,& .document-footer,& .composer-document .lead-block,& .composer-document .content-block{padding:25px 20px}
    & .content-block .form-grid{grid-template-columns:1fr}
    & .block-toolbar h2{font-size:18px}
    & .block-toolbar{margin-bottom:20px}
    & #preview-pane{height:calc(100dvh - 210px);min-height:500px;padding:18px 12px 0}
    & .preview-controls{flex-wrap:nowrap}
    & #review-pane{height:auto;padding:26px 16px 45px}
    & #content-picker-dialog{padding:20px}
    & #content-picker{grid-template-columns:1fr;gap:8px;margin-top:14px}
    & #content-picker button{min-height:78px;padding:14px 16px}
  }
}
