body:has(#preparation-existing){font:14px Arial,sans-serif;color:#23475e;background:#f3f6f8;margin:0}:is(.prep-dialog,.prep-form,.prep-existing-popup) :is(button,input,select){font:inherit}:is(.prep-dialog,.prep-form,.prep-existing-popup) button{cursor:pointer;border:1px solid #bacddd;border-radius:5px;background:#edf4f9;color:#23475e;padding:7px 10px}:is(.prep-dialog,.prep-form,.prep-existing-popup) :is(input,select){box-sizing:border-box;min-width:0;border:1px solid #bacddd;border-radius:4px;padding:7px;background:#fff;color:#183b50}:is(.prep-dialog,.prep-form) :is(h1,h2,p){margin:0 0 10px}:is(.prep-dialog,.prep-form) h1{font-size:21px}:is(.prep-dialog,.prep-form) h2{font-size:17px}
#new-project-dialog.prep-dialog{width:96vw;max-width:1700px;height:94dvh;max-height:94dvh;padding:0;overflow:auto}#new-project-dialog.prep-dialog form,.prep-form{display:flex;flex-direction:column;gap:14px;padding:18px;box-sizing:border-box}.prep-head{display:flex;gap:12px;align-items:center;position:sticky;top:0;background:#f3f6f8;z-index:3;padding:8px 0}.prep-head h1,.prep-head h2{margin:0;flex:1}#new-project-dialog .prep-head .dialog-submit{margin-left:auto;width:auto}#new-project-dialog .prep-head .dialog-close{position:static;flex:none}.prep-customer,.prep-files{background:#fff;border:1px solid #c8d7e1;border-radius:8px;padding:14px}.prep-customer{display:grid;grid-template-columns:1fr 2fr;gap:10px 18px}.prep-customer>h2,.prep-customer>p{grid-column:1/-1}#new-project-dialog .prep-customer>label:has([name=project_title]){grid-column:1/-1}#new-project-dialog .prep-customer fieldset{grid-column:2;grid-row:1/5}#new-project-dialog .prep-customer .customer-suggestions{max-height:250px;overflow:auto}.prep-files input[type=file]{display:block;width:100%;margin:8px 0}.prep-files .task-file-list{display:flex;flex-wrap:wrap;gap:8px}.prep-files .task-file-card img{max-height:100px}.prep-files .task-file-tools{display:flex}
.prep-columns{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:14px;align-items:start}.prep-controls{grid-column:1/-1;display:flex;gap:8px;flex-wrap:wrap}.prep-phase{border:1px solid #b9ccda;border-radius:7px;margin-bottom:14px;background:white;padding:10px}.prep-phase-head{display:flex;gap:8px;align-items:center;padding:8px;background:#deedf7;cursor:grab;border-radius:4px}.prep-phase-head input{flex:1;font-weight:bold;background:transparent}.prep-task{display:flex;gap:7px;align-items:center;padding:7px 0;border-bottom:1px solid #e1e8ec;cursor:grab}.prep-task input{flex:1}.prep-task small{max-width:115px}.prep-task-add{display:flex;gap:8px;margin-top:10px}.prep-task-add input{flex:1}.prep-pool{position:sticky;top:65px;border:1px solid #bbcddd;background:#eaf2f8;padding:12px;border-radius:7px}.prep-pool p{font-size:12px;line-height:1.4}.prep-pool input{width:100%;margin:7px 0}.prep-pool-list{max-height:48dvh;overflow:auto}.prep-pool-item{display:grid;grid-template-columns:1fr auto;gap:5px;margin:7px 0;background:white;border:1px solid #bacddd;padding:8px;border-radius:5px;cursor:grab}.prep-pool-item span{grid-column:1/-1;overflow-wrap:anywhere}.prep-remove{border:2px dashed #bb6b64;padding:10px;color:#8c312a;font-size:12px}.prep-drop-active{outline:3px solid #007cba;outline-offset:-3px}.prep-status{color:#805300;white-space:pre-wrap}.prep-existing-popup{width:96vw;max-width:1800px;height:94dvh;max-height:94dvh;padding:12px;border:1px solid #abc2d3;border-radius:10px;box-sizing:border-box}.prep-existing-popup[open]{display:flex;flex-direction:column}.prep-existing-popup iframe{flex:1;width:100%;min-height:0;border:0}.prep-existing-popup .prep-head strong{flex:1}.prep-pencil{flex:none!important}:is(.prep-dialog,.prep-existing-popup)::backdrop{background:#18384d88}
@media(max-width:850px){.prep-columns{grid-template-columns:minmax(0,1fr) 260px}.prep-customer{display:block}.prep-task{flex-wrap:wrap}.prep-task input{min-width:120px}#new-project-dialog .prep-customer fieldset{display:grid;grid-template-columns:1fr 1fr}}@media(max-width:600px){.prep-columns{grid-template-columns:1fr}.prep-pool{position:static;grid-row:2}.prep-controls{grid-row:1}.prep-pool-list{max-height:220px}.prep-phase-head{flex-wrap:wrap}}

/* Compact preparation: shared library occupies 30 percent. */
#new-project-dialog.prep-dialog form,.prep-form{gap:6px;padding:8px;font-size:12px}
:is(.prep-dialog,.prep-form,.prep-existing-popup) :is(button,input,select){font-size:12px;min-height:24px;padding:2px 5px;border-radius:3px}
:is(.prep-dialog,.prep-form) :is(h1,h2,p){margin:0 0 4px}
:is(.prep-dialog,.prep-form) h1{font-size:15px}:is(.prep-dialog,.prep-form) h2{font-size:13px}
.prep-head{gap:6px;padding:3px 0;min-height:28px}.prep-existing-popup{padding:6px}.prep-existing-popup>.prep-head{position:static;font-size:13px}
.prep-customer,.prep-files{padding:6px;border-radius:4px}.prep-customer{gap:4px 10px}
.prep-form>.prep-customer{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}.prep-form>.prep-customer :is(h2,p){margin:0}.prep-form>.prep-customer p:last-child{font-size:11px;color:#607689}
.prep-columns{grid-template-columns:minmax(0,7fr) minmax(0,3fr);gap:8px}
.prep-controls{gap:4px}.prep-controls input{max-width:180px}.prep-phase{padding:4px;margin-bottom:6px;border-radius:4px}
.prep-phase-head{gap:4px;padding:2px 4px}.prep-phase-head input{padding:1px 3px!important;border-color:transparent!important}
.prep-task{gap:4px;padding:1px 0;min-height:26px}.prep-task input{border-color:transparent;background:transparent;padding:1px 4px}
.prep-task input:hover,.prep-task input:focus{border-color:#bacddd;background:#fff}.prep-task small{font-size:10px}.prep-task-add{gap:4px;margin-top:3px}
.prep-pool{position:static;min-width:0;padding:5px;border-radius:4px}.prep-pool-list{max-height:none;overflow:visible}
.prep-pool input{margin:3px 0}.prep-remove{font-size:10px;padding:3px;border-width:1px}.prep-pool-group{margin:6px 0;border-top:1px solid #bdcddb}
.prep-pool-group h3{font-size:12px;margin:0;padding:4px 2px;background:#deedf7}.prep-pool-item{display:grid;grid-template-columns:minmax(0,1fr) 85px 23px 23px;gap:2px;margin:1px 0;padding:1px 2px;border:0;border-bottom:1px solid #dce4eb;border-radius:0;align-items:center;min-height:26px}
.prep-pool-item span{grid-column:auto;line-height:1.2;font-size:11px}.prep-pool-item select{width:100%;font-size:10px;padding:1px;min-height:22px}.prep-pool-item button{padding:0!important;min-height:22px}.prep-pool-delete{color:#ae3434!important}
.prep-pool-add{display:flex;gap:3px;justify-content:flex-end;padding:2px}.prep-pool-add input{flex:1;width:auto;margin:0}.prep-pool-add input[hidden]{display:none}.prep-pool-add button{width:23px;padding:0!important}
.prep-status{font-size:11px;margin:0!important;min-height:0}.prep-status:empty{display:none}
#new-project-dialog.prep-dialog :is(input,select){min-height:25px;padding:3px 5px;margin-top:1px;font-size:12px}
#new-project-dialog.prep-dialog fieldset{gap:4px 8px;padding:4px 8px}#new-project-dialog.prep-dialog label{font-size:11px}#new-project-dialog.prep-dialog .dialog-submit{padding:4px 8px;min-height:26px}
.prep-files .attachment-preview{width:65px;height:55px}.prep-files .attachment-card{max-width:80px}.prep-files small{font-size:10px}





@media(max-width:700px){.prep-columns{grid-template-columns:minmax(0,7fr) minmax(0,3fr)}.prep-pool{grid-row:auto}.prep-pool-item{grid-template-columns:minmax(0,1fr) 23px 23px}.prep-pool-item span{grid-column:1/-1}.prep-pool-item select{width:100%}.prep-phase-head{flex-wrap:nowrap}.prep-task{flex-wrap:wrap}}

/* Insertion marker occupies the gap, never the task itself. */
.prep-task,.prep-task-add{position:relative}
.prep-insert-before::before{content:"";position:absolute;left:0;right:0;top:-2px;height:3px;background:#007cba;border-radius:2px;z-index:2;pointer-events:none;box-shadow:0 0 0 1px #fff}


.phase-order-bar:has(>.prep-pencil){grid-template-columns:32px minmax(0,max-content) 32px 32px}
.phase-order-bar>.prep-pencil{grid-column:4;grid-row:1;width:32px;height:30px;padding:0;display:flex;align-items:center;justify-content:center}
.phase-order-bar>.prep-pencil svg{display:block;flex:none}
@media(max-width:800px){.phase-order-bar:has(>.prep-pencil){grid-template-columns:32px minmax(0,1fr) 32px 32px}}

.prep-phase{position:relative}
.prep-phase-before::before,.prep-phase-after::after{content:"";position:absolute;left:0;right:0;height:3px;background:#007cba;border-radius:2px;z-index:2;pointer-events:none;box-shadow:0 0 0 1px #fff}
.prep-phase-before::before{top:-5px}.prep-phase-after::after{bottom:-5px}


/* Project tasks and shared templates scroll independently. */
.prep-columns{height:clamp(280px,65dvh,900px);min-height:0;flex:none;grid-template-rows:auto minmax(0,1fr);align-items:stretch}
.prep-columns>.prep-controls{grid-row:1}
.prep-columns>.prep-phases,.prep-columns>.prep-pool{grid-row:2;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;box-sizing:border-box}
.prep-columns>.prep-phases{grid-column:1;padding:5px 3px}
.prep-columns>.prep-pool{grid-column:2;position:static;max-height:none}
.prep-columns .prep-pool-list{max-height:none;overflow:visible}
