/* Phone presentation. Loaded last so desktop's established layout stays intact. */
.sd-phone-only { display:none; }
.sd-phone-options, .sd-phone-card-extras { display:contents; }
.sd-phone-plan-options > summary { display:none; }
.sd-phone-conflict-label, .sd-phone-conflict-copies { display:none; }
.sd-phone-backbar { display:none; }
html.sd-phone-mode body {
  --sd-phone-bg:#101010;
  --sd-phone-line:rgba(242,232,213,.11);
  --sd-phone-ink:#f2e8d5;
}
html.sd-phone-mode body #hdr {
  grid-template-columns:44px minmax(0,1fr) 60px 60px 40px !important;
  gap:4px !important;
  min-height:60px !important;
  padding:8px 10px !important;
  background:#090909 !important;
  backdrop-filter:none !important;
  box-shadow:0 1px 0 var(--sd-phone-line) !important;
}
html.sd-phone-mode body #hdr #logo { width:44px !important; min-width:44px !important; max-width:44px !important; height:44px !important; }
html.sd-phone-mode body #hdr #logo img { width:41px !important; min-width:41px !important; max-width:41px !important; height:41px !important; max-height:41px !important; zoom:1 !important; }
html.sd-phone-mode body #hdr #proj-selector { grid-column:2 !important; width:max-content !important; max-width:100% !important; justify-self:start !important; }
html.sd-phone-mode body #hdr #proj-btn { justify-content:center !important; box-sizing:border-box !important; width:auto !important; max-width:100% !important; height:40px !important; min-height:40px !important; padding:0 12.5px !important; gap:4px !important; border-radius:9px !important; background:#1b1b1b !important; }
html.sd-phone-mode body #hdr #proj-btn .proj-name { flex:0 1 auto !important; font-size:12px !important; font-weight:600 !important; letter-spacing:0 !important; text-transform:none !important; transform:translateX(1.5px) !important; }
html.sd-phone-mode body #hdr #proj-btn .caret { display:inline-flex !important; align-items:center !important; justify-content:center !important; width:10px !important; min-width:10px !important; margin:0 !important; transform:translateX(1.5px) !important; }
html.sd-phone-mode body #hdr #mobile-project-home { display:none !important; }
html.sd-phone-mode body #hdr #layer-tabs-left { display:block !important; position:relative !important; grid-column:3 !important; width:60px !important; min-width:0 !important; max-width:60px !important; padding:0 !important; margin:0 !important; overflow:visible !important; }
html.sd-phone-mode body #hdr #layer-dropdown-toggle { display:flex !important; align-items:center !important; justify-content:center !important; width:60px !important; min-width:0 !important; height:40px !important; padding:0 5px !important; border:1px solid var(--sd-phone-line) !important; border-radius:9px !important; background:#1b1b1b !important; color:var(--sd-phone-ink) !important; font-size:11px !important; text-transform:none !important; letter-spacing:0 !important; }
html.sd-phone-mode body #hdr #layer-dropdown-toggle::after { display:none !important; }
html.sd-phone-mode body #hdr #hdr-actions { display:contents !important; }
html.sd-phone-mode body #hdr #hdr-actions-group { display:none !important; }
html.sd-phone-mode body #hdr :is(#logo,#proj-selector,#layer-tabs-left,#mobile-drafts-btn,#hamburger-btn) { grid-row:1 !important; }
html.sd-phone-mode body #hdr #layer-tabs-left { z-index:303 !important; mask-image:none !important; -webkit-mask-image:none !important; border:0 !important; background:none !important; height:40px !important; }
html.sd-phone-mode body #hdr #layer-dropdown-menu { z-index:304 !important; pointer-events:auto !important; }
html.sd-phone-mode body #hdr #mobile-drafts-btn { display:flex !important; grid-column:4 !important; align-items:center !important; justify-content:center !important; width:60px !important; min-width:0 !important; height:40px !important; padding:0 5px !important; background:#1b1b1b !important; border:1px solid rgba(245,158,11,.3) !important; border-radius:9px !important; color:#ffc25c !important; font-size:11px !important; text-transform:none !important; letter-spacing:0 !important; }
html.sd-phone-mode body #mobile-drafts-btn .drafts-manuscript { display:none !important; }
html.sd-phone-mode body #hdr #hamburger-btn { grid-column:5 !important; justify-self:end !important; width:40px !important; min-width:40px !important; border:0 !important; background:transparent !important; font-size:20px !important; color:#ddd2bf !important; }
html.sd-phone-mode body #layer-dropdown-menu { position:fixed !important; top:var(--sd-phone-header-bottom,60px) !important; left:10px !important; right:10px !important; width:auto !important; min-width:0 !important; padding:8px !important; max-height:calc(var(--sd-phone-height,100dvh) - 76px) !important; overflow:auto !important; background:#1b1b1b !important; border:1px solid var(--sd-phone-line) !important; border-radius:14px !important; box-shadow:0 20px 50px #000a !important; }
html.sd-phone-mode body #layer-tabs-left:not(.open) #layer-dropdown-menu { display:none !important; }
html.sd-phone-mode body #layer-tabs-left.open #layer-dropdown-menu { display:grid !important; gap:4px !important; }
html.sd-phone-mode body #layer-dropdown-menu .layer-tab { display:flex !important; width:100% !important; min-height:48px !important; padding:12px 16px !important; margin:0 !important; border:0 !important; border-radius:9px !important; font-size:14px !important; letter-spacing:0 !important; text-transform:none !important; justify-content:flex-start !important; }
html.sd-phone-mode body #layer-dropdown-menu .layer-tab.active { background:#2a2a2a !important; }
html.sd-phone-mode body #proj-dropdown { top:var(--sd-phone-header-bottom,60px) !important; max-height:calc(var(--sd-phone-height,100dvh) - var(--sd-phone-header-bottom,60px) - 10px) !important; background:#1b1b1b !important; }

/* Demo is a small in-flow notice, never a second header over the controls. */
html.sd-phone-mode body.demo-mode { padding-top:0 !important; }
html.sd-phone-mode body #demo-banner { position:relative !important; inset:auto !important; width:100% !important; min-height:34px !important; height:auto !important; padding:8px 12px !important; gap:8px !important; font-size:9px !important; letter-spacing:.05em !important; justify-content:space-between !important; }
html.sd-phone-mode body #demo-banner { z-index:1 !important; }
html.sd-phone-mode body #demo-banner span { display:none !important; }
html.sd-phone-mode body #demo-banner a { margin:0 !important; }

/* Full-screen navigation with a project heading, two useful shortcuts and lists. */
html.sd-phone-mode body #mobile-menu { padding:0 !important; background:var(--sd-phone-bg) !important; backdrop-filter:none !important; }
html.sd-phone-mode body #mobile-menu-panel { width:100% !important; max-width:100% !important; height:100% !important; padding:0 20px calc(20px + env(safe-area-inset-bottom)) !important; background:var(--sd-phone-bg) !important; border:0 !important; box-shadow:none !important; overscroll-behavior:contain; }
html.sd-phone-mode body .mm-header { top:0 !important; margin:0 -20px !important; padding:12px 20px !important; min-height:68px !important; background:var(--sd-phone-bg) !important; }
html.sd-phone-mode body .mm-brand { font-size:11px !important; letter-spacing:.08em !important; color:#d9d0c1 !important; }
html.sd-phone-mode body .mm-brand img { width:43px !important; height:43px !important; }
html.sd-phone-mode body .mm-brand span { font-size:16px !important; }
html.sd-phone-mode body .mm-close { width:44px !important; height:44px !important; border:1px solid var(--sd-phone-line) !important; background:transparent !important; }
html.sd-phone-mode body .mm-project-heading { padding:24px 0 20px; }
html.sd-phone-mode body .mm-project-eyebrow { display:block; margin-bottom:8px; color:#9f978a; font-size:10px; letter-spacing:.12em; text-transform:uppercase; }
html.sd-phone-mode body #mm-project-name { display:block; margin:0; color:#f2e8d5; font-family:var(--font-heading,Georgia,serif); font-size:28px; font-weight:600; line-height:1.17; overflow-wrap:anywhere; }
html.sd-phone-mode body .mm-primary { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:0 0 24px; }
html.sd-phone-mode body .mm-primary button { display:flex; flex-direction:column; align-items:flex-start; justify-content:space-between; gap:16px; min-height:102px; padding:16px; background:#1b1b1b; border:1px solid var(--sd-phone-line); border-radius:14px; color:#f2e8d5; font:600 15px var(--font-ui); text-align:left; }
html.sd-phone-mode body .mm-primary .mm-primary-drafts { color:#fff; border-color:transparent; background:#1b1b1b; }
html.sd-phone-mode body .mm-primary svg { width:23px; height:23px; stroke:currentColor; fill:none; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
html.sd-phone-mode body .mm-section-label { margin:22px 0 8px !important; color:#9f978a !important; font-size:10px !important; font-weight:600 !important; letter-spacing:.12em !important; }
html.sd-phone-mode body .mm-section-label::after { display:none !important; }
html.sd-phone-mode body .mm-list { border-top:1px solid var(--sd-phone-line); }
html.sd-phone-mode body .mm-item { display:flex !important; align-items:center !important; gap:12px !important; width:100% !important; min-height:52px !important; margin:0 !important; padding:12px 2px !important; border:0 !important; border-bottom:1px solid var(--sd-phone-line) !important; border-radius:0 !important; background:none !important; color:#ddd5c8 !important; font-size:14px !important; font-weight:500 !important; letter-spacing:0 !important; text-transform:none !important; text-align:left !important; }
html.sd-phone-mode body .mm-item svg { width:19px; height:19px; flex:0 0 19px; stroke:#9f978a; fill:none; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
html.sd-phone-mode body .mm-item::after { content:'›'; margin-left:auto; color:#82796b; font-size:22px; font-weight:400; }
html.sd-phone-mode body .mm-grid { grid-template-columns:repeat(3,minmax(0,1fr)) !important; gap:8px !important; }
html.sd-phone-mode body .mm-grid-item { min-height:48px !important; padding:8px 4px !important; font-size:12px !important; font-weight:600 !important; letter-spacing:0 !important; text-transform:none !important; border:1px solid var(--sd-phone-line) !important; background:#1b1b1b !important; border-radius:10px !important; }
html.sd-phone-mode body .mm-footer-links { display:flex; gap:24px; padding:24px 0 8px; }
html.sd-phone-mode body .mm-footer-links button { min-height:44px; padding:8px 0; border:0; background:none; color:#a89f91; font-size:12px; }
html.sd-phone-mode body #mobile-menu button:active { background-color:#303030 !important; }

/* The visual viewport tracks phone keyboards without moving the writing behind it. */
html.sd-phone-mode body #sd-focus-overlay.sd-phone-surface,
html.sd-phone-mode body #founder-ai-photo-bg.sd-phone-surface,
html.sd-phone-mode body :is(#mobile-menu,#preview-overlay,#manager-overlay,#ai-chat-modal-bg,#project-search,#modal-bg,#account-modal-bg,#backup-modal-bg,#project-history-modal-bg,#trash-modal-bg,#trash-preview-bg,#vh-modal-bg,#vh-preview-bg,#new-proj-modal-bg,#new-notebook-modal-bg,#dupe-modal-bg,#type-change-modal-bg,#adapt-modal-bg,#upgrade-modal-bg,#cover-crop-modal-bg,#sd-dialog-bg,#edgar-support-bg,#founder-ai-note-bg,#sdt-modal-bg).sd-phone-surface {
  position:fixed !important; inset:auto !important; top:var(--sd-phone-top,0px) !important; left:0 !important;
  width:100% !important; min-width:0 !important; max-width:100% !important;
  height:var(--sd-phone-height,100dvh) !important; min-height:0 !important; max-height:var(--sd-phone-height,100dvh) !important;
  padding:0 !important; margin:0 !important; border-radius:0 !important; transform:none !important;
  z-index:var(--sd-phone-order,10050) !important; overflow:hidden !important; overscroll-behavior:contain;
  background:var(--sd-phone-bg) !important; backdrop-filter:none !important;
}
html.sd-phone-mode body :is(#modal-bg,#account-modal-bg,#backup-modal-bg,#project-history-modal-bg,#trash-modal-bg,#trash-preview-bg,#vh-modal-bg,#vh-preview-bg,#new-proj-modal-bg,#new-notebook-modal-bg,#dupe-modal-bg,#type-change-modal-bg,#adapt-modal-bg,#upgrade-modal-bg,#cover-crop-modal-bg,#sd-dialog-bg,#edgar-support-bg,#founder-ai-note-bg,#sdt-modal-bg).sd-phone-surface > .sd-phone-dialog {
  box-sizing:border-box !important; width:100% !important; min-width:0 !important; max-width:100% !important;
  height:100% !important; min-height:0 !important; max-height:100% !important;
  margin:0 !important; padding:0 18px calc(24px + env(safe-area-inset-bottom)) !important;
  border:0 !important; border-radius:0 !important; box-shadow:none !important;
  background:var(--sd-phone-bg) !important; overflow-x:hidden !important; overflow-y:auto !important;
  overscroll-behavior:contain; scroll-padding-block:80px 24px;
}
html.sd-phone-mode body .sd-phone-backbar { position:sticky; top:0; z-index:10; display:flex; align-items:center; gap:12px; min-height:64px; margin:0 -18px 20px; padding:max(8px,env(safe-area-inset-top)) 18px 8px; background:var(--sd-phone-bg); border-bottom:1px solid var(--sd-phone-line); }
html.sd-phone-mode body .sd-phone-backbar button { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; min-height:44px; padding:0 12px 0 8px; border:1px solid var(--sd-phone-line); border-radius:9px; background:transparent; color:var(--sd-phone-ink); font:500 13px var(--font-ui); }
html.sd-phone-mode body .sd-phone-backbar button::before { content:'‹'; font-size:24px; margin-right:7px; line-height:1; }
html.sd-phone-mode body .sd-phone-backbar span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--sd-phone-ink); font:600 15px var(--font-ui); }
html.sd-phone-mode body .sd-phone-dialog > .modal-hdr,
html.sd-phone-mode body .sd-phone-dialog > .modal-title,
html.sd-phone-mode body .sd-phone-dialog > .sd-dialog-title,
html.sd-phone-mode body .sd-phone-dialog > .settings-modal-scroll > .modal-hdr { display:none !important; }
html.sd-phone-mode body #modal-bg .sd-phone-dialog .settings-modal-scroll { height:auto !important; max-height:none !important; overflow:visible !important; padding:0 !important; mask-image:none !important; -webkit-mask-image:none !important; }
html.sd-phone-mode body .sd-phone-dialog :is(input:not([type=checkbox]):not([type=range]),select,textarea) { min-width:0 !important; max-width:100% !important; font-size:16px !important; }
html.sd-phone-mode body .sd-phone-dialog :is(.btn-sec,.btn-primary,.btn-danger,.trash-action-btn) { min-height:44px !important; }
html.sd-phone-mode body .sd-phone-dialog .modal-note { font-size:12px !important; line-height:1.65 !important; overflow-wrap:anywhere; }
html.sd-phone-mode body .sd-phone-dialog .modal-actions { flex-wrap:wrap !important; gap:8px !important; }
html.sd-phone-mode body .sd-phone-dialog .modal-actions > button { flex:1 1 auto !important; }
html.sd-phone-mode body .sd-phone-dialog .sd-dialog-message { font-size:15px !important; line-height:1.65 !important; overflow-wrap:anywhere; }
html.sd-phone-mode body .sd-phone-dialog .sd-dialog-actions { flex-wrap:wrap !important; margin-top:24px !important; }
html.sd-phone-mode body #new-proj-modal-bg.sd-phone-surface .type-cards { display:grid !important; grid-template-columns:1fr 1fr !important; gap:10px !important; }
html.sd-phone-mode body #new-proj-modal-bg.sd-phone-surface .type-card { display:flex !important; flex-direction:column !important; align-items:flex-start !important; gap:12px !important; min-height:164px !important; padding:16px !important; border:1px solid transparent !important; background:linear-gradient(180deg, rgba(242,232,213,0.067), rgba(242,232,213,0.027)) !important; box-shadow:inset 0 1px 0 rgba(255,255,255,0.025),0 9px 20px rgba(0,0,0,0.12) !important; }
html.sd-phone-mode body #new-proj-modal-bg.sd-phone-surface .type-card-name { font:400 19px 'Pirata One','Courier New',cursive !important; letter-spacing:.06em !important; text-transform:none !important; color:var(--accent) !important; }
html.sd-phone-mode body #new-proj-modal-bg.sd-phone-surface .type-card-sub { display:grid !important; grid-template-columns:1fr !important; gap:3px !important; font:400 12px/1.45 var(--font-ui) !important; color:#afa697 !important; text-transform:none !important; letter-spacing:0 !important; }
html.sd-phone-mode body #new-proj-modal-bg.sd-phone-surface .type-card.selected { border-color:transparent !important; background:linear-gradient(180deg, rgba(181,61,61,0.34), rgba(181,61,61,0.14)) !important; }
html.sd-phone-mode body #new-proj-modal-bg.sd-phone-surface .type-card.selected .type-card-sub { color:#fff !important; opacity:1 !important; }
html.sd-phone-mode body #new-proj-modal-bg.sd-phone-surface .type-card:focus-visible { outline:2px solid #5ac8fa !important; outline-offset:2px !important; }
html.sd-phone-mode body #upgrade-modal-bg.sd-phone-surface > #upgrade-modal.sd-phone-dialog { display:block !important; padding-inline:24px !important; }
html.sd-phone-mode body #upgrade-modal > .sd-phone-backbar { margin-inline:-24px; padding-inline:24px; }
html.sd-phone-mode body #upgrade-modal.sd-phone-dialog .upg-grid { grid-template-columns:1fr !important; }
html.sd-phone-mode body #upgrade-modal-close { display:none !important; }
html.sd-phone-mode body .sd-phone-dialog .trash-row { align-items:stretch !important; flex-direction:column !important; gap:10px !important; }
html.sd-phone-mode body .sd-phone-dialog .trash-row-actions { display:flex !important; flex-wrap:wrap !important; }
html.sd-phone-mode body #project-search.sd-phone-surface { padding:0 18px 18px !important; }
html.sd-phone-mode body #project-search.sd-phone-surface .project-search-popover { position:static !important; height:calc(100% - 84px) !important; }
html.sd-phone-mode body #project-search.sd-phone-surface .project-search-panel { max-height:calc(100% - 54px) !important; overflow:auto !important; }
html.sd-phone-mode body #project-search-input { font-size:16px !important; }
html.sd-phone-mode body :is(#preview-overlay,#manager-overlay,#ai-chat-modal-bg).sd-phone-surface { padding-bottom:env(safe-area-inset-bottom) !important; }
html.sd-phone-mode body #preview-body { min-height:0 !important; }
html.sd-phone-mode body.sdt-tour-preview #preview-overlay.sd-phone-surface { z-index:380 !important; }
html.sd-phone-mode body #sd-focus-overlay .sd-focus-modal { width:100% !important; height:100% !important; min-height:0 !important; max-height:100% !important; gap:0 !important; }
html.sd-phone-mode body #sd-focus-overlay .sd-focus-panel { width:100% !important; height:100% !important; min-height:0 !important; max-height:100% !important; aspect-ratio:auto !important; margin:0 !important; border:0 !important; border-radius:0 !important; }
html.sd-phone-mode body #sd-focus-overlay .sd-focus-card-face { border-radius:0 !important; padding:16px !important; }
html.sd-phone-mode body #sd-focus-overlay .sd-focus-panel-btn { min-width:40px !important; height:44px !important; min-height:44px !important; padding:0 8px !important; }
html.sd-phone-mode body #sd-focus-overlay .sd-focus-card-front .card-label-row { flex-wrap:wrap !important; gap:6px !important; }
html.sd-phone-mode body #sd-focus-overlay .sd-focus-card-editor { font-size:16px !important; mask-image:none !important; -webkit-mask-image:none !important; }
html.sd-phone-mode body .sd-phone-surface :is(#ai-chat-input,#ai-chat-support-subject,#ai-chat-support-message) { font-size:16px !important; }

/* A phone screen has one scroll container. Its contents must fit it too. */
html.sd-phone-mode body .sd-phone-only { display:inline-flex; }
html.sd-phone-mode body .sd-phone-dialog :is(button,input,select,textarea,section,div) { box-sizing:border-box; }
html.sd-phone-mode body .sd-phone-dialog :is(.modal-note,.billing-plan-note,.billing-price-copy,.cloud-project-date) { color:#bdb5a8 !important; opacity:1 !important; }
html.sd-phone-mode body .sd-phone-dialog button:not(:disabled) { opacity:1; }
html.sd-phone-mode body .sd-phone-dialog button:disabled { opacity:.48 !important; cursor:not-allowed; }
html.sd-phone-mode body :is(input,textarea)::placeholder { color:#a39b8f !important; opacity:1; }
html.sd-phone-mode body .card .card-title-input::placeholder,
html.sd-phone-mode body .note-card .card-title-input::placeholder { color:rgba(255,255,255,.24) !important; opacity:1; }
html.sd-phone-mode body #account-modal-bg .account-modal-scroll { width:100% !important; min-width:0 !important; max-width:100% !important; max-height:none !important; overflow:visible !important; padding:0 !important; margin:0 !important; scrollbar-gutter:auto !important; }
html.sd-phone-mode body #account-modal-bg .account-modal-scroll > * { min-width:0; max-width:100%; }
html.sd-phone-mode body #account-modal-bg .account-profile-stack { display:grid !important; grid-template-columns:72px minmax(0,1fr); column-gap:14px !important; row-gap:8px !important; text-align:left; margin-bottom:16px !important; }
html.sd-phone-mode body #account-modal-bg .account-profile-stack > div:first-child { grid-row:1 / 3; width:72px !important; height:88px !important; }
html.sd-phone-mode body #account-photo-preview { width:64px !important; height:64px !important; line-height:64px !important; }
html.sd-phone-mode body #account-modal-bg .account-photo-action { width:36px !important; height:36px !important; bottom:0 !important; }
html.sd-phone-mode body #account-modal-bg .account-profile-line { width:100% !important; min-width:0 !important; max-width:100% !important; margin:0 !important; justify-content:flex-start !important; }
html.sd-phone-mode body #account-status { text-align:left !important; overflow-wrap:anywhere; font-size:13px !important; }
html.sd-phone-mode body #account-display-name { width:100% !important; max-width:100% !important; text-align:left !important; min-height:44px; }
html.sd-phone-mode body #account-modal-bg .account-name-line #account-display-name { width:100% !important; min-width:0 !important; max-width:calc(100% - 24px) !important; flex:1 1 0 !important; }
html.sd-phone-mode body #account-profile-wrap > div:last-child { gap:8px !important; }
html.sd-phone-mode body #account-profile-wrap > div:last-child button { flex:1; min-width:0; padding:10px 8px; font-size:12px; }
html.sd-phone-mode body #account-modal-bg .billing-panel { padding:18px 0 !important; margin:0 !important; }
html.sd-phone-mode body #account-modal-bg .billing-status-card { padding:14px !important; margin:0 0 10px !important; }
html.sd-phone-mode body #account-modal-bg .billing-current-row { flex-wrap:wrap; gap:8px; }
html.sd-phone-mode body #account-modal-bg .billing-plan-label { font-size:13px !important; }
html.sd-phone-mode body #account-modal-bg .billing-plan-note { font-size:13px !important; line-height:1.55 !important; }
html.sd-phone-mode body .sd-phone-plan-options { border:1px solid var(--sd-phone-line); border-radius:10px; padding:0 12px; }
html.sd-phone-mode body .sd-phone-plan-options > summary { display:list-item; min-height:44px; padding:12px 0; color:#ddd5c8; cursor:pointer; font:500 13px var(--font-ui); }
html.sd-phone-mode body #account-modal-bg .billing-price-grid { display:grid !important; grid-template-columns:minmax(0,1fr) !important; gap:10px !important; margin:0 0 12px; }
html.sd-phone-mode body #account-modal-bg .billing-price-grid { grid-auto-rows:1fr !important; }
html.sd-phone-mode body #account-modal-bg .billing-price-card { min-width:0 !important; width:100% !important; min-height:172px !important; padding:12px !important; gap:8px !important; }
html.sd-phone-mode body #account-modal-bg .billing-price-copy { font-size:13px !important; line-height:1.55 !important; margin:0 !important; }
html.sd-phone-mode body #account-modal-bg .billing-price-actions { margin-top:auto !important; padding-top:0 !important; }
html.sd-phone-mode body #account-modal-bg .billing-price-actions { display:flex !important; min-height:44px !important; }
html.sd-phone-mode body #account-modal-bg .billing-price-actions button { display:inline-flex !important; align-items:center !important; justify-content:center !important; width:100%; min-width:0 !important; min-height:44px !important; padding:10px !important; }
html.sd-phone-mode body #account-modal-bg .account-modal-scroll > .modal-actions { display:none !important; }
html.sd-phone-mode body #account-modal-bg :is(.account-sync-current-btn,.account-load-cloud-btn,#billing-portal-btn) { width:100% !important; min-width:0 !important; white-space:normal; padding:12px 8px !important; }
html.sd-phone-mode body #cloud-project-list { max-height:none !important; overflow:visible !important; }
html.sd-phone-mode body .cloud-project-row { gap:10px; min-width:0; }
html.sd-phone-mode body .cloud-project-row > div { flex:1; min-width:0; overflow-wrap:anywhere; }

/* Drafts: a short control stack and a full-width writing measure. */
html.sd-phone-mode body #preview-bar { grid-template-columns:44px minmax(0,1fr) repeat(4,var(--sd-editor-control-size)) !important; column-gap:2px !important; padding:4px 10px !important; row-gap:0 !important; min-height:96px !important; }
html.sd-phone-mode body #preview-bar-title { box-sizing:border-box !important; line-height:1.35 !important; padding:2px 0 4px !important; }
html.sd-phone-mode body #preview-options { gap:4px !important; padding:0 !important; height:44px !important; }
html.sd-phone-mode body #preview-options { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px !important; }
html.sd-phone-mode body #preview-options > #preview-toolbar-toggle.is-visible { display:flex !important; width:44px !important; min-width:44px !important; height:40px !important; visibility:visible !important; }
html.sd-phone-mode body #preview-options > #preview-toolbar-toggle { align-items:center !important; justify-content:center !important; padding:0 !important; font:600 11px var(--font-ui) !important; color:#d5c7b1 !important; background:#222222 !important; border-radius:7px !important; }
html.sd-phone-mode body #preview-options .preview-toggle { height:38px !important; min-height:38px !important; padding:0 10px !important; border-radius:7px !important; }
html.sd-phone-mode body #preview-overlay #preview-options#preview-options button#pv-toggle-layers.preview-toggle.on,
html.sd-phone-mode body #preview-overlay #preview-options#preview-options button#pv-toggle-working.preview-toggle.on,
html.sd-phone-mode body #preview-overlay #preview-options#preview-options button#pv-toggle-layers.preview-toggle.on:hover,
html.sd-phone-mode body #preview-overlay #preview-options#preview-options button#pv-toggle-working.preview-toggle.on:hover { color:#5ac8fa !important; -webkit-text-fill-color:#5ac8fa !important; }
html.sd-phone-mode body #preview-overlay[data-pv-mode="layers"] #preview-options#preview-options button#pv-toggle-layers#pv-toggle-layers.preview-toggle,
html.sd-phone-mode body #preview-overlay[data-pv-mode="working"] #preview-options#preview-options button#pv-toggle-working#pv-toggle-working.preview-toggle { color:#5ac8fa !important; -webkit-text-fill-color:#5ac8fa !important; }
html.sd-phone-mode body #preview-toolbar-toggle.is-visible { display:flex !important; }
html.sd-phone-mode body #preview-body.pv-focus-mode { padding:0 !important; }
html.sd-phone-mode body #preview-body.pv-focus-mode .pv-focus-content { padding:18px 16px 32px !important; width:100% !important; max-width:100% !important; min-width:0 !important; }
html.sd-phone-mode body #preview-overlay #preview-body.pv-focus-mode .pv-focus-shell { display:block !important; width:100% !important; max-width:100% !important; min-width:0 !important; }
html.sd-phone-mode body #preview-body .pv-focus-toolbar { flex:0 0 auto !important; min-height:48px !important; padding:4px 10px !important; overflow:visible !important; }
html.sd-phone-mode body #preview-body .pv-focus-toolbar.is-collapsed { display:none !important; }
html.sd-phone-mode body .pv-focus-toolbar-controls { width:100% !important; min-width:0 !important; max-width:100% !important; display:flex !important; flex-wrap:wrap !important; gap:4px !important; overflow:visible !important; }
html.sd-phone-mode body .pv-focus-toolbar-controls > :is(button,select) { flex:0 0 auto; min-height:40px !important; height:40px !important; min-width:40px; max-width:100%; }
html.sd-phone-mode body .pv-focus-toolbar-controls > select { width:112px !important; min-width:0 !important; font-size:11px !important; padding:0 8px !important; }
html.sd-phone-mode body .pv-focus-toolbar-controls > select[data-focus-width] { width:146px !important; }
html.sd-phone-mode body .pv-focus-toolbar-controls > .fmt-sep { display:none !important; }
html.sd-phone-mode body .pv-focus-toolbar-controls > .sd-phone-format-extra { display:none !important; }
html.sd-phone-mode body .pv-focus-toolbar-controls.sd-phone-tools-expanded > .sd-phone-format-extra { display:inline-flex !important; }
html.sd-phone-mode body .sd-phone-format-more { padding:0 10px !important; font:600 12px var(--font-ui); color:#ddd5c8; }
html.sd-phone-mode body #preview-overlay #preview-body :is(.pv-focus-format-btn,.pv-focus-refine-btn) { color:#a39b8f !important; -webkit-text-fill-color:#a39b8f !important; }
html.sd-phone-mode body #preview-overlay #preview-body .pv-focus-format-btn { background:rgba(242,232,213,0.025) !important; background-image:none !important; border-color:rgba(242,232,213,0.10) !important; box-shadow:none !important; }
html.sd-phone-mode body #preview-overlay #preview-body :is(.pv-focus-format-btn,.pv-focus-refine-btn):is(:hover,.active,.loading) { color:#5ac8fa !important; -webkit-text-fill-color:#5ac8fa !important; }
html.sd-phone-mode body #preview-overlay #preview-body .sd-phone-format-more { color:#a39b8f !important; -webkit-text-fill-color:#a39b8f !important; }
html.sd-phone-mode body #preview-body .pv-focus-content :is(.pv-final-editor,.pv-live-story-editor,.pv-freeflow-editor) { width:100% !important; max-width:100% !important; margin:0 !important; }
html.sd-phone-mode body #preview-body .pv-focus-content :is([contenteditable=true],.pv-final-editor) { font-size:max(16px,var(--pv-ref-font-size,16px)) !important; line-height:1.65 !important; }
html.sd-phone-mode body #preview-body .pv-focus-content :is(.pv-freeflow-breadcrumb,.pv-scene-breadcrumb,.pv-live-story-breadcrumb) { color:#b2a99b !important; font-size:10px !important; margin:12px 0 !important; }
html.sd-phone-mode body #preview-overlay #preview-body .pv-live-story-section > .pv-scene-breadcrumb { display:flex !important; flex-wrap:wrap !important; gap:4px !important; min-width:0 !important; max-width:100% !important; }
html.sd-phone-mode body #preview-overlay #preview-body .pv-live-story-section > .pv-scene-breadcrumb::after { display:none !important; }
html.sd-phone-mode body #preview-overlay #preview-body .pv-live-story-section > .pv-scene-breadcrumb > .pv-scene-convert-btn { width:40px !important; min-width:40px !important; height:40px !important; flex-basis:40px !important; margin-left:auto !important; }
html.sd-phone-mode body #preview-overlay #preview-body .pv-scene-breadcrumb { flex-wrap:wrap !important; min-width:0 !important; max-width:100% !important; }

/* Séance keeps the conversation or library above a growing, unclipped composer. */
html.sd-phone-mode body #ai-chat-modal { height:100% !important; max-height:100% !important; min-height:0 !important; }
html.sd-phone-mode body #ai-chat-hdr { min-height:60px; padding:6px 12px !important; }
html.sd-phone-mode body #ai-chat-hdr-title { flex:1; }
html.sd-phone-mode body .ai-chat-hdr-name { gap:0 !important; line-height:1.2 !important; }
html.sd-phone-mode body .ai-chat-hdr-name-edgar { display:block; font-family:var(--font-reading) !important; font-size:18px !important; line-height:1.15 !important; color:var(--teal) !important; white-space:nowrap; }
html.sd-phone-mode body #ai-chat-hdr-actions { position:static; }
html.sd-phone-mode body .sd-phone-options { display:none; position:absolute; top:60px; right:12px; z-index:30; width:min(290px,calc(100% - 24px)); padding:10px; background:#222222; border:1px solid #444444; border-radius:12px; box-shadow:0 16px 40px #000a; }
html.sd-phone-mode body .sd-phone-options.open { display:grid; gap:8px; }
html.sd-phone-mode body .sd-phone-options > button { width:100%; min-height:44px; text-align:left; color:#eee5d7 !important; }
html.sd-phone-mode body .sd-phone-options > button:disabled { opacity:.45 !important; }
html.sd-phone-mode body #ai-chat-modebar { flex-wrap:nowrap !important; padding:0 12px 6px !important; gap:4px !important; }
html.sd-phone-mode body .ai-chat-mode-btn { flex:1; min-height:40px !important; padding:0 10px !important; border-radius:8px !important; font-size:12px; }
html.sd-phone-mode body #ai-chat-research-controls { padding-top:8px; border-top:1px solid var(--sd-phone-line); }
html.sd-phone-mode body #ai-chat-research-controls:not([hidden]) { display:grid !important; grid-template-columns:1fr; }
html.sd-phone-mode body #ai-chat-research-tabs { min-height:48px; padding:2px 12px 6px !important; gap:6px !important; overflow-x:auto; scrollbar-width:thin; }
html.sd-phone-mode body .ai-chat-research-tab { border-radius:8px !important; min-height:40px !important; }
html.sd-phone-mode body .ai-chat-research-drag-handle { display:none !important; }
html.sd-phone-mode body :is(.ai-chat-research-add,.ai-chat-research-rename,.ai-chat-research-tab-close) { min-height:40px !important; }
html.sd-phone-mode body #ai-chat-input-row { flex:0 0 auto !important; padding:8px 12px max(8px,env(safe-area-inset-bottom)) !important; }
html.sd-phone-mode body #ai-chat-input-wrap { display:flex !important; align-items:center !important; min-height:52px !important; height:auto !important; max-height:none !important; padding:4px !important; overflow:visible !important; }
html.sd-phone-mode body #ai-chat-input { box-sizing:border-box !important; flex:1; width:0 !important; min-width:0 !important; min-height:44px !important; max-height:132px !important; padding:10px 8px !important; line-height:24px !important; resize:none !important; overflow-y:auto !important; color:#eee5d7 !important; }
html.sd-phone-mode body #ai-chat-send-btn { flex:0 0 44px; align-self:center !important; }
html.sd-phone-mode body #ai-chat-empty-state { margin:auto !important; padding:24px 10px !important; }
html.sd-phone-mode body #ai-chat-empty-state p { font-size:14px !important; line-height:1.6 !important; color:#c1b8a9 !important; }
html.sd-phone-mode body #ai-chat-empty-state .ai-chat-empty-hint { font-size:12px !important; color:#a89f91 !important; }
html.sd-phone-mode body #ai-chat-modal :is(#sd-phone-seance-more,#ai-chat-close-btn) { height:40px !important; min-height:40px !important; }
html.sd-phone-mode body #ai-chat-modal #sd-phone-seance-more { padding:0 7px !important; }
html.sd-phone-mode body #ai-chat-modal #ai-chat-close-btn { width:40px !important; min-width:40px !important; padding:0 !important; }
html.sd-phone-mode body #ai-chat-notes-workspace { grid-template-rows:repeat(2,minmax(0,1fr)) !important; overflow:hidden !important; min-height:0 !important; }
html.sd-phone-mode body #ai-chat-notes-library { grid-row:1; min-height:0 !important; }
html.sd-phone-mode body #ai-chat-notes-conversation { grid-row:2; min-height:0 !important; border-top:1px solid var(--border2); border-bottom:0 !important; }
html.sd-phone-mode body #ai-chat-notes-conversation .ai-chat-notes-pane-heading { display:none !important; }
html.sd-phone-mode body #ai-chat-notes-messages { padding:8px 12px !important; }
html.sd-phone-mode body #ai-chat-notes-messages .edgar-notes-empty { margin:0 !important; padding:0 !important; border:0 !important; font-size:12px !important; line-height:1.5 !important; color:#bdb5a8 !important; }
html.sd-phone-mode body .ai-chat-notes-toolbar { padding:6px 12px !important; gap:6px !important; }
html.sd-phone-mode body #ai-chat-notes-search { min-width:0 !important; width:0 !important; flex:1 !important; padding:8px !important; }
html.sd-phone-mode body .ai-chat-notes-archive-toggle { padding:0 7px !important; font-size:10px !important; }
html.sd-phone-mode body #ai-chat-notes-grid { padding:8px 12px 16px !important; gap:10px !important; }
html.sd-phone-mode body .edgar-note-card { min-height:200px !important; padding:12px !important; }
html.sd-phone-mode body #ai-chat-modal :is(.edgar-note-title,.edgar-note-content,.edgar-note-tags) { color:#e2d9cb !important; }

/* A compact project library, retaining cover identity and every card action. */
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card { display:grid !important; grid-template-columns:58px minmax(0,1fr); grid-template-rows:auto auto auto !important; column-gap:14px !important; row-gap:2px !important; min-height:120px !important; height:auto !important; aspect-ratio:auto !important; padding:12px !important; border-radius:12px !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card > .mgr-card-icon { grid-column:1; grid-row:1 / 4; position:relative !important; inset:auto !important; width:58px !important; height:84px !important; min-height:0 !important; transform:none !important; margin:0 !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card :is(.mgr-custom-cover,.mgr-cover) { position:absolute !important; inset:0 !important; width:100% !important; height:100% !important; border-radius:5px !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-label { grid-column:2; grid-row:1; position:static !important; width:auto !important; padding:0 !important; margin:0 !important; transform:none !important; text-align:left !important; white-space:normal !important; overflow-wrap:anywhere; font:600 15px/1.3 var(--font-ui) !important; letter-spacing:0 !important; text-transform:none !important; color:#eee5d7 !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-sublabel { grid-column:2; grid-row:2; position:static !important; transform:none !important; width:auto !important; padding:0 !important; margin:0 !important; text-align:left !important; font-size:10px !important; letter-spacing:.06em !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-actions { grid-column:2; grid-row:3; display:flex !important; position:static !important; opacity:1 !important; transform:none !important; width:auto !important; margin:6px 0 0 !important; padding:0 !important; gap:4px !important; flex-wrap:wrap !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-actions { visibility:visible !important; pointer-events:auto !important; max-width:100% !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card { max-height:none !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-action-btn { min-width:40px !important; height:40px !important; padding:0 7px !important; font-size:10px !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card .mgr-card-action-btn { display:flex !important; align-items:center; justify-content:center; border-radius:8px !important; background:#292929 !important; color:#d8caba !important; -webkit-text-fill-color:#d8caba !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card .mgr-card-open-btn { color:#ffc970 !important; -webkit-text-fill-color:#ffc970 !important; }
html.sd-phone-mode body #manager-overlay .mgr-folder-section-body { min-height:0 !important; padding:8px 12px !important; }
html.sd-phone-mode body #manager-overlay .mgr-folder-section-body > .mgr-grid:empty { margin:0 !important; min-height:0 !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-logline { display:none !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-current-dot { top:8px !important; left:8px !important; right:auto !important; }

/* The action launcher leaves the writing layout stable. */
html.sd-phone-mode body #grid .card:has(.sd-phone-card-more) { min-height:0 !important; height:auto !important; padding:14px !important; }
html.sd-phone-mode body #grid .card:has(.sd-phone-card-more) > .card-title-input { min-height:74px !important; height:auto; max-height:260px !important; margin:10px 0 12px !important; font-size:16px !important; line-height:1.5 !important; mask-image:none !important; -webkit-mask-image:none !important; }
html.sd-phone-mode body #grid .card:has(.sd-phone-card-more) .card-footer { display:grid !important; grid-template-columns:auto minmax(0,1fr) auto; gap:8px !important; margin:0 !important; }
html.sd-phone-mode body #grid .card:has(.sd-phone-card-more) .card-footer-tools { display:contents !important; }
html.sd-phone-mode body .sd-phone-card-more { grid-column:1; grid-row:1; justify-self:start; align-items:center; justify-content:center; width:44px; min-width:44px; height:44px; padding:0; border-radius:8px; border:0; background:rgba(242,232,213,0.045) !important; color:#ddd; font:600 24px/1 var(--font-ui); }
html.sd-phone-mode body #grid .card .card-rating { grid-column:2; grid-row:1; justify-self:center; align-self:center; gap:0; }
html.sd-phone-mode body #grid .card .card-rating-btn { width:18px; min-width:18px; height:44px; font-size:11px; }
html.sd-phone-mode body #grid .card .card-open-btn { grid-column:3; grid-row:1; }
html.sd-phone-mode body #grid .card .sd-phone-card-extras { display:none; grid-column:1 / -1; grid-row:2; flex-wrap:wrap; align-items:center; gap:8px; padding:12px 0 0; border-top:1px solid var(--sd-phone-line); }
html.sd-phone-mode body #grid .sd-phone-card-extras :is(.card-color-picker,.card-del-btn,.card-drag-handle) { position:static !important; transform:none !important; opacity:1 !important; }
html.sd-phone-mode body #grid .sd-phone-card-extras .touch-move-btns { position:static !important; display:flex !important; flex-direction:row !important; gap:8px !important; }
html.sd-phone-mode body #grid .sd-phone-card-extras :is(button,.note-color-dot) { min-width:40px !important; min-height:40px !important; }
html.sd-phone-mode body #grid .sd-phone-card-extras .card-ai-tools button::after { content:attr(data-phone-label); font-size:10px; padding-left:5px; }
html.sd-phone-mode body #grid .sd-phone-card-extras .card-ai-tools { display:grid !important; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px !important; width:100%; }
html.sd-phone-mode body #grid .card.sd-phone-card-ready .card-footer-tools .sd-phone-card-extras .card-ai-icon-btn { display:flex !important; align-items:center; justify-content:center; width:100% !important; min-width:0 !important; max-width:none !important; flex:none !important; padding:8px 4px !important; height:44px !important; font-size:0 !important; }
html.sd-phone-mode body #grid .sd-phone-card-extras .card-ai-tools button svg { position:static !important; transform:none !important; width:16px !important; height:16px !important; flex:0 0 16px; }
html.sd-phone-mode body #grid .sd-phone-card-extras .card-ai-tools[hidden] { display:none !important; }
html.sd-phone-mode body #grid .card-color-picker { gap:6px !important; }
html.sd-phone-mode body #grid .scene-page-editor { height:auto !important; min-height:210px !important; max-height:none !important; overflow:visible !important; resize:none !important; padding:16px !important; font-size:17px !important; line-height:1.65 !important; }
html.sd-phone-mode body #grid .scene-pages-workspace { margin:18px 0 !important; }
html.sd-phone-mode { --sd-edgar-safe-bottom:env(safe-area-inset-bottom,0px); --sd-edgar-safe-right:env(safe-area-inset-right,0px); }
html.sd-phone-mode body .mm-seance { color:#5ac8fa !important; }
html.sd-phone-mode body .mm-seance svg { stroke:#5ac8fa !important; }
html.sd-phone-mode body #grid .card:has(.sd-phone-card-more) > .card-title-input { font-size:var(--sd-surface-editor-font-size,16px) !important; }
html.sd-phone-mode body #sd-focus-overlay .sd-focus-card-editor { font-size:var(--sd-focus-editor-font-size,16px) !important; }
html.sd-phone-mode body #preview-body .pv-focus-content :is([contenteditable=true],.pv-final-editor) { font-size:var(--pv-ref-font-size,16px) !important; }
html.sd-phone-mode body #preview-body.draft-focus-mode .pv-focus-content :is([contenteditable=true],.pv-final-editor) { font-size:var(--pv-final-font-size,16px) !important; }

/* Export is opened from a drawer that has closed, so it has its own context. */
html.sd-phone-mode body #export-menu.sd-phone-surface,
html.sd-phone-mode body #cloud-conflict-banner.sd-phone-conflict-review {
  position:fixed !important; inset:auto !important; top:var(--sd-phone-top,0px) !important; left:0 !important; right:auto !important;
  display:block !important; box-sizing:border-box; width:100% !important; max-width:100% !important; min-width:0 !important;
  height:var(--sd-phone-height,100dvh) !important; max-height:var(--sd-phone-height,100dvh) !important;
  margin:0 !important; padding:0 18px 24px !important; border:0 !important; border-radius:0 !important;
  z-index:var(--sd-phone-order,10050) !important; background:var(--sd-phone-bg) !important; overflow:auto !important;
}
html.sd-phone-mode body #export-menu > button { display:flex !important; align-items:center; width:100% !important; min-height:62px !important; margin:0 0 8px !important; padding:14px !important; color:#e6ddce !important; font-size:15px !important; text-transform:none !important; letter-spacing:0 !important; text-align:left; }
html.sd-phone-mode body #export-menu > button::after { content:'↓'; margin-left:auto; color:#b6aa98; }
html.sd-phone-mode body #cloud-conflict-banner:not(.sd-phone-conflict-review) { position:relative !important; inset:auto !important; display:flex !important; width:100% !important; box-sizing:border-box; gap:8px !important; margin:0 !important; padding:8px 12px !important; border-radius:0 !important; background:#262626 !important; box-shadow:none !important; z-index:2 !important; }
html.sd-phone-mode body #cloud-conflict-banner:not(.sd-phone-conflict-review) > :not(.sd-phone-conflict-label):not(.sd-phone-conflict-review-btn) { display:none !important; }
html.sd-phone-mode body .sd-phone-conflict-label { display:block; color:#edc88c; font:600 12px var(--font-ui); flex:1; }
html.sd-phone-mode body .sd-phone-conflict-review-btn { align-items:center; justify-content:center; min-height:40px; border:1px solid #886329; border-radius:8px; padding:8px 12px; color:#f4dbb3; background:#303030; }
html.sd-phone-mode body #cloud-conflict-banner.sd-phone-conflict-review > :is(.sd-phone-conflict-label,.sd-phone-conflict-review-btn) { display:none !important; }
html.sd-phone-mode body #cloud-conflict-banner.sd-phone-conflict-review > .cloud-conflict-message { display:block; font:400 15px/1.6 var(--font-ui); color:#ddd4c5; margin-bottom:20px; }
html.sd-phone-mode body .sd-phone-conflict-copies { display:grid; gap:12px; margin-bottom:20px; }
html.sd-phone-mode body .sd-phone-conflict-copies article { padding:14px; border:1px solid #4c4030; background:#1c1c1c; border-radius:12px; }
html.sd-phone-mode body .sd-phone-conflict-copies h3 { margin:0 0 10px; font:600 15px var(--font-ui); color:#f2e0bd; }
html.sd-phone-mode body .sd-phone-conflict-copies p { margin:6px 0; font:400 14px/1.5 var(--font-ui); }
html.sd-phone-mode body .sd-phone-conflict-copies .sd-phone-copy-meta { color:#b8ac9a; font-size:12px; }
html.sd-phone-mode body #cloud-conflict-banner.sd-phone-conflict-review > button { width:100%; min-height:48px; margin:0 0 10px; padding:10px; color:#eee3d0; }
html.sd-phone-mode body #cloud-conflict-banner.sd-phone-conflict-review > [data-cloud-action=download] { border:1px solid #98713a; background:#303030; }

/* Ordinary controls use filled surfaces. Branded avatar/Edgar rings and the
   meaningful story-layer accents keep their established identity. Layered
   important rules also cover legacy control-specific border overrides. */
@layer sd-control-surfaces {
  html body :is(button,input:not([type=range]):not([type=checkbox]),textarea,select,summary,[role=button]):not(#ai-chat-fab):not(.account-photo):not(.account-avatar):not(.note-color-dot) {
    border-color:transparent !important; outline:none !important;
    box-shadow:0 3px 9px rgba(0,0,0,.12) !important;
  }
  html body :is(button,summary,[role=button]):focus-visible:not(:disabled):not(.note-color-dot):not(#ai-chat-fab):not(.account-photo):not(.account-avatar):not(.edgar-note-category):not(.ai-chat-research-tab):not(.card-drag-handle):not(.sd-back-actions button) {
    background-color:#484848 !important; background-image:none !important; color:#fff3db !important;
    -webkit-text-fill-color:#fff3db !important; outline:none !important;
    text-decoration:underline !important; text-decoration-thickness:2px !important; text-underline-offset:4px !important;
  }
}
@layer sd-control-surfaces {
  html body #grid.project-search-results-grid .project-search-penultimate-pad {
    border-color:transparent !important;
    border-top-color:rgb(90,200,250) !important;
  }
  html body #grid.project-search-results-grid .project-search-penultimate-pad.draft {
    border-top-color:rgb(245,158,11) !important;
  }
  html body #grid.project-search-results-grid .project-search-note-card,
  html body #grid.project-search-results-grid .project-search-note-card:hover {
    border-top-color:var(--project-search-note-accent) !important;
  }
  html body #grid.project-search-results-grid .project-search-note-card .card-open-btn,
  html body #grid.project-search-results-grid .project-search-note-card .card-open-btn:hover,
  html body #grid.project-search-results-grid .project-search-note-card .card-open-btn:focus-visible {
    background-color:var(--sd-button-black) !important;
    background-image:none !important;
  }
}
html.sd-phone-mode body :is(.sd-phone-plan-options,.sd-phone-conflict-copies article,#ai-chat-input-wrap) { border-color:transparent !important; background-color:#1e1e1e !important; }
html.sd-phone-mode body .sd-phone-options { border-color:transparent !important; }
html.sd-phone-mode body .sd-phone-options { max-height:calc(var(--sd-phone-height,100dvh) - 76px); overflow:auto; }
html.sd-phone-mode body .sd-phone-research-order { display:none; }
html.sd-phone-mode body .sd-phone-options:has(#ai-chat-research-controls:not([hidden])) .sd-phone-research-order { display:grid; gap:6px; }
html.sd-phone-mode body .sd-phone-backbar button { background:#232323; }
html.sd-phone-mode body #ai-chat-modal :is(.ai-chat-hdr-btn,.ai-chat-mode-btn,.ai-chat-notes-archive-toggle) { color:#c9c0b2 !important; }
html.sd-phone-mode body #ai-chat-modal .ai-chat-mode-btn.active { color:#5ac8fa !important; }
html.sd-phone-mode body #ai-chat-modal button:disabled { opacity:.45 !important; }
html.sd-phone-mode body #ctx-hdr .ctx-title-row { display:grid !important; grid-template-columns:minmax(0,1fr) auto !important; gap:6px !important; }
html.sd-phone-mode body #ctx-hdr .ctx-title-row > #ctx-logline { grid-column:1 !important; grid-row:1 !important; width:100% !important; min-width:0 !important; max-width:100% !important; }
html.sd-phone-mode body #sd-phone-context-more { grid-column:2; grid-row:1; }
html.sd-phone-mode body .ctx-title-row:has(#ctx-card-actions[hidden]) #sd-phone-context-more { display:none !important; }
html.sd-phone-mode body #ctx-hdr #ctx-card-actions.ctx-card-actions { grid-row:3; grid-column:1 / -1; flex-wrap:wrap !important; width:100% !important; height:auto !important; min-height:44px !important; gap:6px !important; margin:0 0 8px !important; }
html.sd-phone-mode body #ctx-hdr .ctx-title-row:not(.sd-phone-context-open) #ctx-card-actions { display:none !important; }
html.sd-phone-mode body #ctx-hdr #layer-adjacent-row.layer-adjacent-row:not([hidden]) { grid-column:1 / -1; grid-row:2; display:flex !important; flex-wrap:wrap; height:auto !important; min-height:40px !important; justify-content:flex-end; }
html.sd-phone-mode body #ctx-hdr #ctx-card-actions.ctx-card-actions > :is(.ctx-distill-icon-btn,.card-history-btn,.card-archive-clear-btn),
html.sd-phone-mode body #ctx-hdr #ctx-card-actions.ctx-card-actions .ctx-logline-font-btn,
html.sd-phone-mode body #ctx-hdr #layer-adjacent-row.layer-adjacent-row .layer-adjacent-nav:not([hidden]) { width:40px !important; min-width:40px !important; max-width:40px !important; height:40px !important; min-height:40px !important; flex-basis:40px !important; background:#222222 !important; }
html.sd-phone-mode body #ctx-hdr #ctx-card-actions .ctx-logline-font-tools { min-width:86px !important; width:86px !important; max-width:86px !important; flex-basis:86px !important; height:40px !important; }
html.sd-phone-mode body #edgar-note-focus-bg.sd-phone-surface:not([hidden]) { position:fixed !important; inset:auto !important; top:var(--sd-phone-top,0px) !important; left:0 !important; width:100% !important; height:var(--sd-phone-height,100dvh) !important; margin:0 !important; padding:0 !important; z-index:var(--sd-phone-order,10060) !important; }
html.sd-phone-mode body #edgar-note-focus { width:100% !important; height:100% !important; max-height:100% !important; padding:12px !important; border:0 !important; border-radius:0 !important; }
html.sd-phone-mode body #ai-chat-notes-grid { grid-auto-rows:max-content !important; }
html.sd-phone-mode body #ai-chat-notes-grid .edgar-note-card { display:grid !important; grid-template-rows:auto auto 112px 44px !important; gap:8px !important; min-height:0 !important; height:auto !important; max-height:none !important; padding:12px !important; }
html.sd-phone-mode body #ai-chat-notes-grid .edgar-note-card :is(.edgar-note-title,.edgar-note-content,.edgar-note-tags) { box-sizing:border-box !important; min-height:0 !important; max-height:none !important; margin:0 !important; padding:8px !important; }
html.sd-phone-mode body #ai-chat-notes-grid .edgar-note-title { height:48px !important; overflow:auto !important; resize:none !important; }
html.sd-phone-mode body #ai-chat-notes-grid .edgar-note-content { height:112px !important; overflow:auto !important; resize:none !important; }
html.sd-phone-mode body #ai-chat-notes-grid .edgar-note-tags { height:44px !important; min-height:44px !important; width:100% !important; }
html.sd-phone-mode body #ai-chat-modal select {
  -webkit-appearance:none !important; appearance:none !important; padding-right:26px !important;
  background-color:#222222 !important;
  background-image:linear-gradient(45deg,transparent 50%,#bdb5a8 50%),linear-gradient(135deg,#bdb5a8 50%,transparent 50%) !important;
  background-position:calc(100% - 15px) 50%,calc(100% - 10px) 50% !important;
  background-size:5px 5px !important; background-repeat:no-repeat !important;
}
@media (prefers-reduced-motion:no-preference) {
  html.sd-phone-mode body #mobile-menu.open #mobile-menu-panel { animation:sd-phone-menu-in .18s ease-out; }
  @keyframes sd-phone-menu-in { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
}

/* Corrections verified against populated custom-cover/avatar phone fixtures. */
html.sd-phone-mode body #hdr #layer-tabs-left #layer-dropdown-menu { border:0 !important; padding:8px !important; background:#1b1b1b !important; }
html.sd-phone-mode body #hdr #layer-tabs-left #layer-dropdown-menu :is(.layer-tab,#proj-home-tab) { display:flex !important; width:100% !important; max-width:100% !important; box-sizing:border-box; justify-content:flex-start !important; min-height:44px !important; border-radius:8px !important; padding:10px 14px !important; }
html.sd-phone-mode body #ctx-hdr .ctx-title-row { grid-template-columns:minmax(0,1fr) auto auto !important; align-items:center !important; gap:4px !important; }
html.sd-phone-mode body #ctx-hdr #sd-phone-context-more { grid-column:3 !important; grid-row:1 !important; width:44px !important; min-width:44px !important; padding:0 !important; }
html.sd-phone-mode body #ctx-hdr #layer-adjacent-row.layer-adjacent-row:not([hidden]) { grid-column:2 !important; grid-row:1 !important; width:auto !important; min-width:0 !important; max-width:none !important; flex-wrap:nowrap !important; }
html.sd-phone-mode body #ctx-hdr #layer-adjacent-row.layer-adjacent-row .layer-adjacent-nav:not([hidden]) { border-radius:8px !important; }
html.sd-phone-mode body #ctx-hdr :is(#sd-phone-context-more,#layer-adjacent-row .layer-adjacent-nav:not([hidden])) { color:#fff !important; -webkit-text-fill-color:#fff !important; opacity:1 !important; }
html.sd-phone-mode body #ctx-hdr #ctx-card-actions.ctx-card-actions { grid-row:2 !important; margin:0 !important; }
html.sd-phone-mode body #ctx-hdr #ctx-card-actions.ctx-card-actions button { border-radius:8px !important; background:#222222 !important; }
html.sd-phone-mode body #ctx-hdr #ctx-logline { margin:0 !important; }
html.sd-phone-mode body #ctx-hdr #ctx-label-input { line-height:1.4 !important; }
html.sd-phone-mode body #ctx-hdr #ctx-label-input { margin:8px 0 0 !important; padding:0 !important; }
html.sd-phone-mode body #main { padding-top:12px !important; }
html.sd-phone-mode body #grid .card:has(.sd-phone-card-more) > .card-title-input { height:var(--sd-phone-card-height,74px) !important; flex:0 0 auto !important; margin:8px 0 !important; }
html.sd-phone-mode body #grid .scene-pages-workspace { margin:0 0 20px !important; }
html.sd-phone-mode body #grid .scene-page-tabs-row { margin-bottom:8px !important; }
html.sd-phone-mode body #grid .scene-pages-workspace .storypad-label { margin-bottom:8px !important; }
html.sd-phone-mode body #grid .scene-page-editor { font-size:16px !important; line-height:1.55 !important; padding:12px !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card.custom-cover-card :is(.mgr-card-label,.mgr-card-sublabel) { position:static !important; inset:auto !important; width:auto !important; max-width:100% !important; transform:none !important; text-align:left !important; padding:0 !important; }
html.sd-phone-mode body .sd-phone-project-options { min-width:64px; }
html.sd-phone-mode body .sd-phone-project-options summary { min-height:40px; padding:12px; border-radius:8px; background:#222222; color:#d8caba; cursor:pointer; font:500 12px var(--font-ui); }
html.sd-phone-mode body .sd-phone-project-options[open] { flex:1; }
html.sd-phone-mode body #manager-overlay #mgr-tree .sd-phone-project-options > .mgr-card-action-btn { width:100% !important; margin-top:4px !important; justify-content:flex-start !important; font-size:12px !important; background:transparent !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree .sd-phone-project-options > :is(.mgr-bg-action-btn,.danger) { font-size:0 !important; }
html.sd-phone-mode body .sd-phone-project-options > :is(.mgr-bg-action-btn,.danger)::after { content:attr(title); font-size:12px; }
html.sd-phone-mode body #account-modal-bg .account-profile-stack > div:first-child { height:84px !important; }
html.sd-phone-mode body .sd-phone-photo-actions { grid-column:1 / -1; grid-row:3; display:grid; grid-template-columns:1fr 1fr; gap:8px; }
html.sd-phone-mode body #account-modal-bg .sd-phone-photo-actions .account-photo-action { position:static !important; width:100% !important; height:44px !important; min-height:44px !important; border-radius:8px !important; font-size:0 !important; background:#222222 !important; color:#ded4c3 !important; }
html.sd-phone-mode body .sd-phone-photo-actions .account-photo-action::after { content:attr(title); font:500 12px var(--font-ui); }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode { padding:8px 16px 24px !important; }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode :is(.pv-reference-pane,.pv-final-pane) { border:0 !important; border-radius:0 !important; padding:0 !important; background:transparent !important; box-shadow:none !important; }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode .pv-pane-header { padding:0 !important; margin:0 0 8px !important; min-height:40px !important; }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode .pv-reference-pane .pv-reference-title { display:none !important; }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode .pv-pane-actions { width:100% !important; justify-content:flex-start !important; gap:4px !important; flex-wrap:wrap !important; }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode .pv-pane-actions button { min-width:40px !important; min-height:40px !important; height:40px !important; border-radius:8px !important; }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode :is(.pv-ref-content,.pv-final-content) { padding:0 !important; }
html.sd-phone-mode body #preview-overlay #preview-body.final-draft-mode.sd-phone-read-mode .pv-pane-header { display:none !important; }
html.sd-phone-mode body #preview-options { display:grid !important; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 64px !important; }
html.sd-phone-mode body #preview-overlay #preview-options #preview-toolbar-toggle { width:64px !important; min-width:64px !important; max-width:64px !important; flex:0 0 64px !important; height:44px !important; min-height:44px !important; padding:0 10px !important; border-radius:8px !important; white-space:nowrap !important; }
html.sd-phone-mode body #preview-options .preview-toggle { height:44px !important; min-height:44px !important; border-radius:8px !important; }

/* Action menus forward to the original controls, which retain their card context. */
html.sd-phone-mode body #sd-phone-actions { position:fixed !important; inset:0 !important; z-index:var(--sd-phone-order,10070) !important; display:flex !important; align-items:flex-end; justify-content:center; padding:16px 12px max(16px,env(safe-area-inset-bottom)); background:rgba(0,0,0,.5); box-sizing:border-box; }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action-panel { width:100%; max-width:430px; max-height:calc(var(--sd-phone-height,100dvh) - 100px); overflow:auto; overscroll-behavior:contain; padding:12px; border:0; border-radius:16px; background:#171717; box-shadow:0 16px 50px #0008; }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; color:#eee; font:600 16px var(--font-ui); }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action-close { width:44px; height:44px; border-radius:8px; background:#262626; color:#ddd; font:400 24px var(--font-ui); }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action-colors { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 6px 16px; }
html.sd-phone-mode body #sd-phone-actions .note-color-dot { width:40px !important; height:40px !important; min-width:40px !important; min-height:40px !important; flex:0 0 40px; }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action-list { display:grid; grid-template-columns:1fr; gap:4px; }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action { display:flex; align-items:center; justify-content:flex-start; gap:12px; width:100%; min-height:44px; padding:10px 12px; border-radius:8px; background:#222; color:#eee; font:500 14px/1.4 var(--font-ui); text-align:left; white-space:normal; }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action svg { width:18px; height:18px; flex:0 0 18px; }
html.sd-phone-mode body #sd-phone-actions .sd-phone-action:disabled { opacity:.4; }

/* Shared phone rhythm and reading surfaces, measured in populated views. */
html.sd-phone-mode body :is(#grid,#grid.project-home-grid) { gap:24px !important; }
html.sd-phone-mode body #grid .scene-pages-workspace { margin-bottom:8px !important; }
html.sd-phone-mode body #grid > :is(.project-home-stats,.scoped-stats-wrap) { margin-top:8px !important; }
html.sd-phone-mode body .sd-phone-backbar span { margin-left:auto; text-align:right; }
html.sd-phone-mode body #main:has(#grid-section[data-view]) { padding-bottom:16px !important; }
html.sd-phone-mode body #grid-section[data-view] { padding-bottom:0 !important; margin-bottom:16px !important; }
html.sd-phone-mode body .app-site-footer { padding:20px 14px calc(72px + env(safe-area-inset-bottom)) !important; }
html.sd-phone-mode body #ctx-hdr[data-view=home] { margin-bottom:29px !important; }
html.sd-phone-mode body #hdr #mobile-drafts-btn { color:#fff !important; -webkit-text-fill-color:#fff !important; }

/* Covers lead each project row; its actions stay aligned below the title. */
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-grid { gap:24px !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card { grid-template-columns:104px minmax(0,1fr) !important; grid-template-rows:auto auto minmax(44px,auto) !important; gap:8px 20px !important; min-height:156px !important; padding:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card:not(.has-bg) { background:transparent !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card > .mgr-card-icon { width:104px !important; height:156px !important; border-radius:6px !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-label { display:block !important; -webkit-line-clamp:unset !important; font-size:17px !important; line-height:1.35 !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-actions { align-self:end; align-items:center !important; justify-content:flex-start !important; gap:8px !important; margin:0 !important; }
html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-open-btn { width:auto !important; min-width:74px !important; height:44px !important; padding:0 14px !important; font-size:12px !important; }
html.sd-phone-mode body .sd-phone-project-options { display:none !important; }
html.sd-phone-mode body #manager-overlay .sd-phone-project-more { display:flex !important; flex:0 0 44px; margin:0; }

/* Phone Drafts has Prose and Script, with the same outer reading column. */
html.sd-phone-mode body #preview-overlay #preview-options { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
html.sd-phone-mode body #preview-overlay #preview-options #preview-toolbar-toggle,
html.sd-phone-mode body #preview-overlay #preview-toolbar-toggle.is-visible,
html.sd-phone-mode body #preview-overlay #pv-toggle-draft { display:none !important; }
html.sd-phone-mode body #preview-overlay #preview-body.pv-focus-mode { padding:0 !important; }
html.sd-phone-mode body #preview-overlay #preview-body.pv-focus-mode .pv-focus-content { box-sizing:border-box !important; width:100% !important; max-width:100% !important; padding:16px 16px 32px !important; }
html.sd-phone-mode body #preview-overlay #preview-body.pv-focus-mode .pv-focus-content > .pv-final-editor.pv-draft { box-sizing:border-box !important; width:100% !important; max-width:min(100%,var(--pv-focus-doc-width,100%)) !important; margin:0 auto !important; padding:0 !important; }
html.sd-phone-mode body #preview-overlay #preview-body.pv-focus-mode .pv-focus-toolbar { display:block !important; box-sizing:border-box !important; width:100% !important; padding:8px 16px !important; border:0 !important; }
html.sd-phone-mode body #preview-overlay .pv-focus-toolbar-controls:not(.sd-phone-tools-expanded) { display:grid !important; grid-template-columns:minmax(88px,126px) 40px 40px 76px 60px !important; gap:4px !important; }
html.sd-phone-mode body #preview-overlay .pv-focus-toolbar-controls:not(.sd-phone-tools-expanded) > select[title="Text Style"] { width:100% !important; }
html.sd-phone-mode body #preview-overlay #preview-body .pv-focus-toolbar-controls > .sd-phone-primary-action { display:inline-flex !important; align-items:center; justify-content:center; min-width:0 !important; width:76px !important; padding:0 8px !important; font-size:11px !important; }
html.sd-phone-mode body #preview-overlay .pv-focus-toolbar-controls:not(.sd-phone-tools-expanded) > .sd-phone-format-more { width:60px !important; padding:0 8px !important; }

/* Give the conversation controls their own inset, without divider bands. */
html.sd-phone-mode body #ai-chat-modal #ai-chat-hdr { flex:0 0 auto !important; min-height:76px !important; padding:16px 16px 12px !important; gap:12px !important; border:0 !important; box-shadow:none !important; background:transparent !important; }
html.sd-phone-mode body #ai-chat-modal #ai-chat-hdr-title { gap:8px !important; }
html.sd-phone-mode body #ai-chat-modal #ai-chat-modebar {
  display:grid !important;
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  padding:8px 16px 12px !important;
  gap:6px 8px !important;
  border:0 !important;
  box-shadow:none !important;
  background:transparent !important;
  overflow-x:hidden !important;
}
html.sd-phone-mode body #ai-chat-modal #ai-chat-modebar > .ai-chat-mode-btn {
  box-sizing:border-box !important;
  width:100% !important;
  min-width:0 !important;
  padding:0 6px !important;
}
html.sd-phone-mode body #ai-chat-modal #ai-chat-modebar > .ai-chat-hdr-sub {
  display:none !important;
}
html.sd-phone-mode body #ai-chat-modal #ai-chat-research-tabs { padding:4px 16px 12px !important; border:0 !important; background:transparent !important; }
html.sd-phone-mode body #ai-chat-modal .ai-chat-research-tab { padding:8px 12px !important; gap:8px !important; max-width:260px !important; min-height:44px !important; background:transparent !important; border:0 !important; }
html.sd-phone-mode body #ai-chat-modal .ai-chat-research-tab-label { padding:2px 0; color:#ccc; }
html.sd-phone-mode body #ai-chat-modal .ai-chat-research-tab.active .ai-chat-research-tab-label { color:var(--teal); text-decoration:underline; text-underline-offset:5px; }
html.sd-phone-mode body #ai-chat-modal :is(.ai-chat-research-add,.ai-chat-research-rename,.ai-chat-research-tab-close) { background:transparent !important; }
html.sd-phone-mode body #ai-chat-modal .edgar-note-category { box-sizing:border-box !important; padding:8px 28px 8px 12px !important; min-width:0 !important; width:100%; max-width:100%; background-color:transparent !important; box-shadow:none !important; color:var(--edgar-note-accent) !important; -webkit-text-fill-color:var(--edgar-note-accent) !important; text-indent:0 !important; }
html.sd-phone-mode body #ai-chat-modal :is(.edgar-note-category,.ai-chat-research-tab):focus-visible { text-decoration:underline !important; text-underline-offset:5px; }
html.sd-phone-mode body #account-modal-bg .account-profile-stack { display:flex !important; flex-direction:column; align-items:center; gap:0 !important; text-align:center; }
html.sd-phone-mode body #account-modal-bg .account-profile-stack > div:first-child { width:88px !important; height:88px !important; margin-bottom:16px; }
html.sd-phone-mode body #account-modal-bg .account-profile-line { justify-content:center !important; }
html.sd-phone-mode body #account-modal-bg #account-status { text-align:center !important; }
html.sd-phone-mode body #account-modal-bg .account-name-line { margin-top:2px !important; }
html.sd-phone-mode body #account-modal-bg .account-name-line #account-display-name { flex:0 1 auto !important; width:calc((var(--account-name-ch,8) * .56em) + 14px) !important; min-width:54px !important; text-align:center !important; }
html.sd-phone-mode body #account-modal-bg .sd-phone-photo-actions { width:100%; margin-top:12px; }
@media (max-width:360px) {
  html.sd-phone-mode body #ai-chat-modal #ai-chat-hdr { padding:14px 12px 10px !important; gap:6px !important; }
  html.sd-phone-mode body #ai-chat-modal .ai-chat-hdr-name-edgar { font-size:16px !important; }
  html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card { grid-template-columns:88px minmax(0,1fr) !important; column-gap:16px !important; min-height:132px !important; }
  html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card > .mgr-card-icon { width:88px !important; height:132px !important; }
  html.sd-phone-mode body #manager-overlay #mgr-tree[data-view=covers] .mgr-card-label { font-size:15px !important; }
  html.sd-phone-mode body #preview-overlay .pv-focus-toolbar-controls:not(.sd-phone-tools-expanded) { grid-template-columns:minmax(0,1fr) 44px 64px !important; }
  html.sd-phone-mode body #preview-overlay #preview-body .pv-focus-toolbar-controls:not(.sd-phone-tools-expanded) > .sd-phone-primary-action { grid-column:1 / 3; width:100% !important; }
  html.sd-phone-mode body #preview-overlay .pv-focus-toolbar-controls:not(.sd-phone-tools-expanded) > .sd-phone-format-more { grid-column:3; width:64px !important; }
}

/* Keep tall phone grids out of whole-surface transform/opacity compositing. */
html.sd-phone-mode body #grid { transition:none !important; }
html.sd-phone-mode body #grid.out { opacity:1 !important; transform:none !important; }
/* Seed failures stay short dismissible messages over the unchanged workspace. */
html.sd-phone-mode body #sd-dialog-bg.sd-phone-surface.sd-compact-message.open { display:flex !important; align-items:center !important; justify-content:center !important; padding:16px !important; background:rgba(0,0,0,.65) !important; }
html.sd-phone-mode body #sd-dialog-bg.sd-phone-surface.sd-compact-message > .sd-phone-dialog { flex:none !important; width:min(420px,100%) !important; height:fit-content !important; max-height:calc(100% - 32px) !important; padding:24px !important; border-radius:12px !important; outline:none !important; }
html.sd-phone-mode body #sd-dialog-bg.sd-compact-message .sd-phone-backbar { display:none !important; }
html.sd-phone-mode body #sd-dialog-bg.sd-compact-message .sd-dialog-title { display:block !important; }
html.sd-phone-mode body #sd-dialog-bg.sd-compact-message #sd-dialog-cancel { display:none !important; }
