/* Shared project rows follow the Video Editor rail: a name and compact actions. */
.project-library {
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  padding:0 0 10px;
  margin:0 0 10px;
  border-bottom:1px solid var(--line);
}
.project-library-heading {
  display:flex;
  flex:none;
  align-items:center;
  gap:8px;
  margin:0 0 8px;
}
.project-library-heading h2 {
  flex:1;
  margin:0;
  font:600 14px var(--ui-font);
  letter-spacing:0;
  text-transform:none;
}
.project-library-heading .project-collapse {
  display:grid;
  place-items:center;
  width:32px;
  height:32px;
  padding:0;
}
.project-library-content {
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  gap:8px;
}
.project-library.collapsed .project-library-content { display:none; }
.project-library-toolbar button,
.photo-project-toolbar #newPhotoProject,
.local-app #blankVMProject {
  width:100%;
  min-height:34px;
  margin:0;
  padding:6px 8px;
}
.project-library input.project-search {
  width:100%;
  margin:0;
  padding:7px 8px;
}
.project-library [hidden],
.project-storage:empty,
#photoProjectStorage:empty { display:none!important; }
.project-rows {
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  max-height:250px;
  gap:8px;
  overflow:hidden auto;
  overscroll-behavior:contain;
}
.dp-project-row {
  display:flex;
  align-items:stretch;
  flex:none;
  gap:3px;
  min-width:0;
  width:100%;
  margin:0;
}
.dp-project-row .dp-project-open {
  display:block;
  flex:1 1 0;
  width:auto;
  min-width:0;
  min-height:36px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:5px;
  background:var(--bg);
  color:var(--text);
  text-align:left;
  white-space:normal;
  overflow-wrap:anywhere;
  line-height:1.3;
}
.dp-project-row .dp-project-open:is([aria-pressed=true],[aria-current=true],[aria-selected=true]) {
  border-color:var(--green);
  background:color-mix(in srgb,var(--green) 12%,var(--bg));
}
.dp-project-open b {
  display:block;
  font-size:13px;
  font-weight:600;
}
.dp-project-open small {
  display:block;
  margin-top:2px;
  color:var(--muted);
  font-size:10px;
  line-height:1.3;
}
.dp-project-row button:focus-visible,
.project-library-heading button:focus-visible,
.project-library-toolbar button:focus-visible { outline-offset:-2px!important; }
.project-storage,.project-list-empty {
  margin:0;
  color:var(--muted);
  font-size:11px;
  line-height:1.5;
}
.project-list-empty { padding:8px 2px; }
.photo-project.dp-project-row {
  border:0;
  padding:0;
  background:none;
}
.photo-project.dp-project-row .photo-project-open {
  display:flex;
  min-height:36px;
  gap:5px;
}
.photo-project.dp-project-row .photo-project-open img { width:28px; height:24px; }
.photo-project.dp-project-row .photo-project-open b { white-space:normal; }
#photoProjectList,#vmProjects { gap:5px; overflow-x:hidden; }
.local-app #vmProjects { display:flex; flex-direction:column; }
.local-app .vm-project-toolbar { display:flex; gap:5px; align-items:stretch; flex:none; }
.local-app #renameVMProject { width:36px; flex:none; padding:0; }
.local-app #vmProjects .dp-project-open { flex:1 1 0; }
@media (max-width:850px), (pointer:coarse) {
  .project-library-toolbar button,.photo-project-toolbar #newPhotoProject,.local-app #blankVMProject { min-height:44px; }
  .dp-project-row .dp-project-open { min-height:44px; }
  .project-library input.project-search { font-size:16px; min-height:44px; }
  .mobile-ui.photo-app .photo-project.dp-project-row .photo-project-open { min-height:44px; }
}

body:is(.audio-app,.cad-app):not(.mobile-ui) :is(.app-panel-close,#audioMobileMenu,#cadMobileMenu) {
  display:none!important;
}
#photoProjectList { container-type:inline-size; }
@container (max-width:210px) {
}

/* The project tools keep their position while the list scrolls. */
.project-library-toolbar { flex:none; }
.project-library .project-search { flex:none; }
.project-library .project-storage { flex:none; }
.project-library-content { gap:10px; }
.project-library-heading { margin-bottom:10px; }
#photoProjectList,#vmProjects { gap:8px; }
.photo-project.dp-project-row .photo-project-open { align-items:center; }
.photo-project.dp-project-row .photo-project-open img { flex:none; }
.photo-project.dp-project-row .photo-project-open > span { min-width:0; }

.dp-project-row { align-items:center; gap:6px; }
.dp-project-open :is(b,small) { min-width:0; overflow-wrap:anywhere; white-space:normal; }
.dp-project-row .dp-project-menu-trigger { flex:none; }
.dp-project-menu-trigger,.dp-project-actions button { touch-action:manipulation; }
.dp-project-actions { display:none; }
.dp-project-actions:popover-open {
  position:fixed;
  inset:auto;
  margin:0;
  display:grid;
  min-width:min(160px,calc(100vw - 16px));
  max-width:calc(100vw - 16px);
  max-height:calc(100dvh - 16px);
  overflow:auto;
  overscroll-behavior:contain;
  gap:2px;
  padding:4px;
  border:1px solid var(--line);
  border-radius:8px;
  box-shadow:0 8px 24px #0005;
  background:var(--panel-solid,var(--panel));
  color:var(--text);
}
.dp-project-row .dp-project-actions button {
  justify-content:flex-start;
  min-height:36px;
  width:100%;
  height:auto;
  padding:8px 10px;
  text-align:left;
  white-space:normal;
  overflow-wrap:anywhere;
  background:transparent;
  color:var(--text);
  border:1px solid transparent;
}
.dp-project-row .dp-project-actions button:is(:hover,:focus-visible) {
  background:var(--bg);
  border-color:var(--line);
}
.dp-project-row .dp-project-actions button:is([data-project-action=delete],[data-photo-project-action=delete],.delete-project):hover {
  color:var(--pink);
}

/* Drawers are siblings of the editing workspace. The list owns the scroll area. */
html body dialog.dp-project-drawer {
  inset:0 auto 0 0!important;
  margin:0!important;
  width:min(360px,calc(100vw - 24px))!important;
  max-width:calc(100vw - 24px)!important;
  height:100dvh;
  max-height:100dvh!important;
  box-sizing:border-box;
  padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  border:0;
  border-inline-end:1px solid var(--line);
  border-radius:0;
  overflow:hidden;
  overscroll-behavior:contain;
  background:var(--panel-solid,var(--panel));
  color:var(--text);
}
html body dialog.dp-project-drawer[open] { display:flex; flex-direction:column; gap:12px; }
.dp-project-drawer::backdrop { background:#0008; }
.dp-project-drawer-heading {
  display:flex;
  flex:none;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.dp-project-drawer-heading h2 { margin:0; font:600 16px var(--ui-font); letter-spacing:0; }
.dp-project-drawer .project-library { flex:1 1 auto; overflow:hidden; margin:0; padding:0; border:0; }
.dp-project-drawer .project-library-content { flex:1 1 auto; overflow:hidden; }
.dp-project-drawer .project-rows { flex:1 1 auto; max-height:none; }
.dp-project-drawer-footer { display:flex; flex:none; flex-wrap:wrap; gap:8px; }
.dp-project-drawer-footer:empty { display:none; }
.dp-project-drawer-footer > :is(button,input) { flex:1 1 130px; min-height:40px; }
@media (max-width:900px), (pointer:coarse) {
  .mobile-ui .dp-desktop-projects { display:none!important; }
  .dp-project-row .dp-project-actions button,
  .dp-project-drawer-footer > :is(button,input) { min-height:44px; }
}

/* The closed project list uses no horizontal workspace. */
body.dp-has-project-edge .dp-project-launch-original { display:none!important; }
body:has(.dp-project-edge-drawer[open]) > button.dp-project-edge-toggle { visibility:hidden; }
button.dp-project-edge-toggle {
  position:fixed!important;
  inset:max(8px,env(safe-area-inset-top)) auto auto 0!important;
  display:grid!important;
  place-items:center;
  box-sizing:border-box;
  z-index:160;
  width:29px!important;
  min-width:29px!important;
  max-width:29px!important;
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  padding:0!important;
  margin:0!important;
  border:1px solid var(--line);
  border-left:0;
  border-radius:0 22px 22px 0;
  background:var(--panel-solid,var(--panel));
  color:var(--text);
  cursor:pointer;
  touch-action:manipulation;
}
button.dp-project-edge-toggle::before {
  content:"";
  width:7px;
  height:7px;
  border-block-start:2px solid currentColor;
  border-inline-end:2px solid currentColor;
  transform:translateX(-1px) rotate(45deg);
}
button.dp-project-edge-toggle:is([aria-expanded=true],.dp-project-edge-close)::before {
  transform:translateX(2px) rotate(-135deg);
}
button.dp-project-edge-toggle:hover { color:var(--green); }
button.dp-project-edge-toggle:focus-visible { outline:2px solid var(--cyan,var(--green)); outline-offset:-3px; }
button.dp-project-edge-close { font-size:0!important; background:var(--panel-solid,var(--panel))!important; }
button.dp-project-edge-close > svg { display:none; }
.dp-project-edge-drawer .dp-project-drawer-heading { padding-inline-start:26px; min-height:40px; }
html body .dp-project-edge-drawer#mobileProjectDialog > h2 { padding-inline-start:24px; }
body.dp-has-project-edge:not(.daw-app) :is(header.dp-app-header,header.app-header,header.photo-header,header.studio-header) {
  padding-inline-start:37px!important;
}
body.dp-has-project-edge.daw-app > header { padding-inline-start:37px!important; }
body.dp-has-project-edge :is(.project-rail,.photo-project-heading) h2,
body.dp-has-project-edge :is(.projects-heading,.photo-project-heading) strong { margin-inline-start:28px; }
.cut-app.projects-collapsed > .project-rail { display:none!important; }
.local-app .vm-projects.collapsed:has(.dp-project-launch-original) { display:none; }
body.dp-has-project-edge :is(#dawMobileProjectsToggle,#photoProjectsButton,#mobileProjectMenu,#pdfProjectsToggle,#appProjectsToggle).dp-project-launch-original {
  display:none!important;
}
/* Desktop project drawers leave the underlying workspace in place. */
.photo-app.dp-has-project-edge:not(.mobile-ui) .photo-body {
  grid-template-columns:64px minmax(0,1fr) min(var(--photo-inspector-width,250px),55vw);
}
.photo-app.dp-has-project-edge:not(.mobile-ui).photo-projects-collapsed .photo-project-rail { display:none; }
@media(max-width:1100px) {
  .photo-app.dp-has-project-edge:not(.mobile-ui) .photo-body {
    grid-template-columns:64px minmax(0,1fr) min(var(--photo-inspector-width,210px),55vw);
  }
}
.photo-app.dp-has-project-edge:not(.mobile-ui) .photo-project-rail,
body[data-app=emulator].dp-has-project-edge .vm-projects:not(.collapsed) {
  position:fixed;
  inset:56px auto 0 0;
  z-index:155;
  width:min(300px,90vw);
  background:var(--panel-solid,var(--panel));
  box-shadow:14px 0 36px #0005;
}
@media(min-width:851px) {
  .pdf-app.dp-has-project-edge .studio-layout { grid-template-columns:0 80px minmax(0,1fr) 250px; }
  .pdf-app.dp-has-project-edge .pdf-tool-rail { grid-column:2; grid-row:1; }
  .pdf-app.dp-has-project-edge .studio-main { grid-column:3; grid-row:1; }
  .pdf-app.dp-has-project-edge .studio-properties { grid-column:4; grid-row:1; }
  .pdf-app.dp-has-project-edge .studio-sidebar,
  body.dp-has-project-edge .workspace-projects {
    position:fixed;
    inset:var(--studio-header-height,65px) auto 0 0;
    z-index:155;
    width:min(300px,90vw);
    background:var(--panel-solid,var(--panel));
    box-shadow:14px 0 36px #0005;
  }
}
@media(min-width:851px) and (max-width:1100px) {
  .pdf-app.dp-has-project-edge .studio-layout { grid-template-columns:0 80px minmax(0,1fr) 210px; }
}

/* The drawer heading and project actions use the same layout in each app. */
.dp-project-heading {
  display:flex;
  align-items:center;
  gap:8px;
  flex:none;
  min-height:42px;
}
.dp-project-heading :is(h2,strong) {
  flex:1;
  margin:0;
  text-transform:none;
  font-size:16px;
  font-weight:600;
  letter-spacing:0;
}
.dp-project-heading .dp-project-workspace {
  display:inline-grid;
  place-items:center;
  flex:none;
  inline-size:36px;
  block-size:36px;
  padding:0;
  font-size:0;
  margin-inline-start:auto;
  margin-inline-end:0;
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--bg);
  color:var(--text);
}
.dp-project-workspace .dp-icon { inline-size:18px; block-size:18px; }
.dp-project-heading .dp-project-workspace:focus-visible { outline-offset:-2px; }
.dp-project-toolbar {
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
  flex:none;
  align-items:stretch;
}
.dp-project-toolbar > button:not([hidden]) {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  min-height:38px;
  width:100%;
  padding:4px 6px;
  margin:0;
  white-space:normal;
  text-align:center;
  line-height:1.2;
}
.projects-content .dp-video-project-toolbar {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
}
.projects-content button:is(#backupProject,#restoreBackup),
#mobileProjectDialog :is([data-mobile-action=saveProject],[data-mobile-action=openProject]),
.dp-project-drawer-footer :is([data-daw-mobile-action=dawSave],[data-daw-mobile-action=dawOpen],#recorderSave,#recorderOpen),
html body.dp-has-project-edge header .workshop-launcher.dp-header-icon { display:none!important; }
.dp-video-drawer-heading { padding-inline-start:24px; }
.project-library-heading .dp-project-workspace { order:3; }
.dp-project-row .dp-project-open {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  gap:2px;
  min-height:44px;
}
.dp-project-row :is(.photo-project-open,[data-project]).dp-project-open {
  flex-direction:row;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
}
.dp-project-row .dp-project-open :is(b,span) { min-width:0; }
.dp-project-row .dp-project-open b {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:100%;
}
.dp-project-row .dp-project-open small {
  max-width:100%;
  color:var(--muted);
  overflow-wrap:anywhere;
}
.dp-project-row .dp-project-open .dp-project-thumbnail,
.dp-project-row .photo-project-open img {
  width:48px;
  height:36px;
  min-width:48px;
  flex:none;
  object-fit:contain;
  border-radius:4px;
  background:var(--panel-solid,var(--panel));
  border:1px solid var(--line);
}
.dp-project-thumbnail-empty { border-style:dashed!important; }
.dp-project-actions [data-project-action=delete],
.dp-project-actions [data-photo-project-action=delete] { border-top:1px solid var(--line)!important; }
#dpProjectTransferStatus {
  position:fixed;
  bottom:12px;
  inset-inline-end:12px;
  max-width:min(420px,calc(100vw - 24px));
  z-index:500;
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px;
  border:1px solid var(--line);
  background:var(--panel-solid,var(--panel));
  color:var(--text);
  border-radius:6px;
}
@media (max-width:900px), (pointer:coarse) {
  .dp-project-heading .dp-project-workspace,
  .dp-project-toolbar > button:not([hidden]) { min-height:44px; }
  .dp-project-heading .dp-project-workspace { inline-size:44px; }
}

html body .dp-project-surface:is(.photo-project-rail,.project-rail,.studio-sidebar,.workspace-projects,.vm-projects):not(.vm-projects.collapsed) {
  position:fixed;
  inset:0 auto 0 0!important;
  box-sizing:border-box;
  z-index:155;
  width:min(360px,calc(100vw - 24px))!important;
  max-width:calc(100vw - 24px)!important;
  height:100dvh!important;
  max-height:100dvh;
  padding:12px;
  background:var(--panel-solid,var(--panel));
  border-inline-end:1px solid var(--line);
  box-shadow:14px 0 36px #0005;
  overflow:hidden;
}
html body #mobileProjectDialog.dp-project-surface {
  width:min(360px,calc(100vw - 24px))!important;
  max-width:calc(100vw - 24px)!important;
  border-radius:0;
}
.dp-has-project-edge .dp-project-surface .project-collapse,
html body.dp-has-project-edge .photo-project-rail .photo-project-heading [data-photo-panel-close],
.dp-has-project-edge #photoMobileDock [data-photo-panel=projects] { display:none!important; }
.dp-project-surface > .dp-project-heading { padding-inline-start:26px; }
.dp-project-surface .dp-project-heading > :is(h2,strong) { margin-inline:0!important; }
.dp-project-surface :is(.project-library-content,.photo-project-content,.projects-content) { min-height:0; }
.dp-project-surface :is(.project-rows,#photoProjectList,#projectTabs,#vmProjects) { overflow:hidden auto; }
.dp-project-surface #vmProjects { min-height:0; }
#mobileProjectsHost #projectTabs { max-height:40dvh; }
.workshop-project-row .dp-project-open { text-decoration:none; }
.workshop-project-row .dp-project-open:hover { border-color:var(--green); }
.workshop-grid.workshop-projects { grid-template-columns:minmax(0,1fr); gap:6px; }
.workshop-projects .workshop-project-item { padding:0; border:0; }
.workshop-project-row .dp-project-open { flex-direction:row; justify-content:flex-start; align-items:center; gap:8px; }
.workshop-project-row .dp-project-open img {
  width:48px;
  height:36px;
  flex:none;
  object-fit:contain;
}

/* The arrow's full touch target stays clear of the drawer title. */
html body .dp-project-surface .dp-project-heading { box-sizing:border-box; padding-inline-start:40px; }
html body .dp-project-surface .dp-project-heading > :is(strong,h2) { padding-inline-start:0!important; }
#projectTabs .dp-project-row > .dp-project-menu-trigger {
  display:inline-grid!important; place-items:center!important; padding:0!important; margin:0; line-height:1;
  min-width:40px; width:40px; height:40px;
}
#projectTabs .dp-project-menu-trigger > .dp-icon { display:block; margin:0; }
.dp-project-row .dp-project-grip {
  display:inline-grid!important; place-items:center; flex:0 0 26px; min-width:26px;
  min-height:40px; padding:0!important; cursor:grab; touch-action:none; color:var(--muted);
  background:transparent; border:1px solid transparent;
}
.dp-project-row .dp-project-grip:is(:hover,:focus-visible) { border-color:var(--line); color:var(--text); }
.dp-project-row[data-project-dragging] { opacity:.6; }
.dp-project-row[data-project-drop=before] { box-shadow:0 -2px var(--green); }
.dp-project-row[data-project-drop=after] { box-shadow:0 2px var(--green); }
@media(max-width:900px),(pointer:coarse) {
  html body .dp-project-surface .dp-project-heading { padding-inline-start:46px; }
  #projectTabs .dp-project-row > .dp-project-menu-trigger { width:44px; min-height:44px; }
  .dp-project-row .dp-project-grip { flex-basis:32px; min-height:44px; }
}

.dp-project-toolbar:has(> .dp-project-open-media) > .dp-project-import {
  grid-column: 1 / -1;
}
