/* Scope all new styles to the work-plan view. Existing CRM controls stay intact. */
#pm-plan{color:#352b1a;font:14px Arial,sans-serif}#pm-plan *{box-sizing:border-box}#pm-plan h2,#pm-plan h3{font-family:Georgia,serif;color:#493313;margin:0 0 10px}#pm-plan h2{font-size:20px}#pm-plan h3{font-size:16px}#pm-plan button{cursor:pointer}#pm-plan button:disabled{opacity:.55;cursor:default}#pm-plan button:focus-visible{outline:3px solid #9a6e14;outline-offset:2px}.pm-controls{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:12px;color:#ead8aa}.pm-controls label{display:flex;gap:6px;align-items:center;margin:0}.pm-controls select{max-width:230px}.pm-controls button,.pm-controls input,.pm-controls select{font-size:13px;min-height:32px;padding:5px 8px}.pm-controls input[type=checkbox]{min-height:0;width:18px;height:18px}.pm-layout{display:grid;grid-template-columns:220px minmax(0,1fr) 250px;gap:12px;align-items:start;position:relative}.pm-paper{background:linear-gradient(115deg,#fff4d1,#eddbad);border:2px ridge #b38e47;padding:12px;min-width:0}.pm-backlog{grid-column:1;grid-row:1}.pm-current{grid-column:2;grid-row:1}.pm-future{grid-column:3;grid-row:1}.pm-calendar{grid-column:1/-1;grid-row:2;display:grid;grid-template-columns:1fr 1fr;gap:18px}.pm-day-head{display:flex;justify-content:space-between;align-items:center;gap:10px;border-bottom:1px solid #b89a58;margin-bottom:12px}.pm-day-head>span{font-size:12px}.pm-day-head button{padding:3px 8px;font-size:12px}.pm-matrix{width:100%;table-layout:fixed;border-collapse:collapse;min-width:0!important}.pm-matrix .pm-order-col{width:26%}.pm-matrix th,.pm-matrix td{padding:9px!important;border:1px solid #c4a569!important;text-align:left;vertical-align:top;white-space:normal!important;color:#352b1a!important}.pm-matrix thead th{font:700 15px Georgia;background:linear-gradient(#f8e8ba,#dfc187)!important;text-transform:none;letter-spacing:normal}.pm-matrix th small{display:block;font:11px/1.4 Arial;color:#78623b;margin-top:6px}.pm-matrix .pm-paint{background:#e4c98a33}.pm-order>img,.pm-no-photo{width:46px;height:50px;object-fit:contain;border:1px solid #bc9e5f;background:#fff3d4;display:flex;align-items:center;justify-content:center;font:10px Arial;color:#87734c}.pm-order>button{display:block;border:0!important;background:none!important;box-shadow:none!important;text-shadow:none!important;color:#352b1a!important;padding:6px 0!important;font:700 13px/1.4 Arial;overflow-wrap:anywhere;min-height:0;text-align:left}.pm-task{margin:0 0 7px;padding:7px;border:1px solid #ab8539;border-left:4px solid var(--pc);background:linear-gradient(130deg,#fff3d4,#ead39d);box-shadow:inset 0 0 0 1px #f9edcd;border-radius:3px;min-width:0}.pm-task-top{display:grid;grid-template-columns:24px minmax(0,1fr) 26px;align-items:center;gap:5px}.pm-task-top .stage-icon{position:static!important;width:24px;height:24px}.pm-task .pm-open{padding:0!important;min-height:26px;background:none!important;box-shadow:none!important;border:0!important;color:#352b1a!important;text-shadow:none!important;font:700 13px/1.35 Arial;text-align:left;white-space:normal;overflow-wrap:anywhere}.pm-task .pm-finish{min-height:24px;padding:2px!important;font-size:12px!important;width:24px}.pm-meta{display:flex;justify-content:space-between;flex-wrap:wrap;gap:5px;margin-top:6px;font-size:11px}.pm-status{padding:2px 4px;background:#e5d0a1;border:1px solid #b79b60;border-radius:2px}.pm-done .pm-open{text-decoration:line-through}.pm-empty{font:12px/1.5 Arial;color:#78623b}.pm-future-list>section{border-top:1px solid #b89a58;padding:8px 0}.pm-future-list h3{font-size:13px!important}.pm-month{min-width:0}.pm-month-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-template-rows:24px repeat(6,minmax(70px,auto));gap:3px}.pm-month-grid>b{font:12px Arial;background:linear-gradient(#f8e8ba,#d5b46b);border:1px solid #ac873e;text-align:center;padding:4px}.pm-date{border:1px solid #d0b87f;background:#fff7e4;padding:4px;min-width:0;font-size:13px}.pm-date:nth-child(7n),.pm-date:nth-child(7n - 1){background:#ecdbb9}.pm-outside{opacity:.4}.pm-today{outline:2px solid #a97817;outline-offset:-2px;background:#ffefb9}.pm-date button{display:block;width:100%;background:var(--pb)!important;border:1px solid #bc9e5f!important;border-left:3px solid var(--pc)!important;box-shadow:none!important;text-shadow:none!important;color:#352b1a!important;font:700 12px/1.3 Arial!important;padding:3px!important;min-height:0!important;margin-top:4px;white-space:normal;overflow-wrap:anywhere}.pm-detail{position:absolute;z-index:10;right:0;top:0;bottom:0;overflow:auto;width:360px;max-width:100%;padding:18px;background:linear-gradient(#fff4d1,#eddbad);border:3px ridge #b38e47;box-shadow:-10px 0 24px #0006}.pm-lines{white-space:pre-wrap}.pm-detail>button{display:block;margin-bottom:12px;font-size:13px}.pm-detail p{font-size:14px;overflow-wrap:anywhere}#pm-plan .wf-backlog{border:0;max-height:none;overflow:visible;padding:0!important;background:none;box-shadow:none}#pm-plan .wf-backlog>p,#pm-plan .wf-backlog>label{display:none}#pm-plan .wf-plan-card{padding:7px!important;margin:8px 0!important;font-size:12px}#pm-plan .wf-plan-card .order-thumbnail{width:40px;height:44px;object-fit:contain}#pm-plan .wf-plan-card button{font-size:11px;padding:4px 6px;min-height:24px}.pm-active .heading{padding:10px;margin-bottom:12px}.pm-active .heading>div>p{display:none}.pm-active .heading h1{font-size:27px}
body.pm-tv aside:not(.pm-detail){display:none}body.pm-tv .workspace{margin-left:0}body.pm-tv header{height:40px;min-height:0;padding:4px 16px}body.pm-tv main{padding:8px 16px;max-width:none;height:calc(100dvh - 40px);display:flex;flex-direction:column;gap:8px}body.pm-tv .heading{flex:none;margin:0;padding:6px 10px}body.pm-tv .heading h1{font-size:23px}body.pm-tv .heading button{padding:5px 10px;font-size:12px;min-height:28px}body.pm-tv footer{display:none}body.pm-tv #content,body.pm-tv #pm-plan{flex:1;min-height:0;display:flex;flex-direction:column}body.pm-tv .pm-controls{flex:none;margin:0 0 8px;gap:8px}body.pm-tv .pm-layout{flex:1;min-height:0;grid-template-columns:minmax(0,1.8fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) 145px 130px;align-items:stretch}body.pm-tv .pm-current{grid-column:1;grid-row:1;overflow:auto}body.pm-tv .pm-future{grid-column:1;grid-row:2;overflow:auto}body.pm-tv .pm-backlog{grid-column:1;grid-row:3;overflow:auto}body.pm-tv .pm-calendar{grid-column:2;grid-row:1/4;display:grid;grid-template-columns:1fr;grid-template-rows:repeat(2,minmax(0,1fr));gap:10px;overflow:auto}body.pm-tv .pm-month{display:flex;flex-direction:column;min-height:0}body.pm-tv .pm-month-grid{flex:1;min-height:0;grid-template-rows:24px repeat(6,minmax(0,1fr))}body.pm-tv .pm-date{font-size:15px}body.pm-tv .pm-date button{font-size:14px!important}body.pm-tv .pm-matrix th,body.pm-tv .pm-matrix td{padding:10px!important}body.pm-tv .pm-matrix thead th{font-size:19px}body.pm-tv .pm-order>img,body.pm-tv .pm-no-photo{float:left;margin-right:10px}body.pm-tv .pm-order>button{font-size:17px}body.pm-tv .pm-order small{clear:both;font-size:13px}body.pm-tv .pm-task .pm-open{font-size:17px}body.pm-tv .pm-meta{font-size:13px}body.pm-tv .pm-future-list{display:flex;gap:12px}body.pm-tv .pm-future-list>section{flex:0 0 240px;padding:0;border-top:0}body.pm-tv .pm-future .pm-task .pm-open{font-size:13px}body.pm-tv .wf-plan-list{display:flex;gap:10px}body.pm-tv .wf-plan-card{flex:0 0 230px;margin:0!important}body.pm-tv .pm-backlog h2,body.pm-tv .pm-future h2{font-size:17px;margin-bottom:5px}body.pm-tv #pm-plan.pm-crowded .pm-current{border-color:#9b6d19}#pm-plan .pm-day-head button:disabled{opacity:.3}
@media(max-width:1200px){.pm-layout{grid-template-columns:190px minmax(0,1fr) 220px}.pm-matrix th,.pm-matrix td{padding:5px!important}.pm-task-top{grid-template-columns:20px minmax(0,1fr) 24px;gap:3px}.pm-task-top .stage-icon{width:20px;height:20px}}
@media(max-width:800px){.pm-layout{display:flex;flex-direction:column}.pm-layout>section{width:100%}.pm-calendar{display:block}.pm-month{margin-bottom:16px}.pm-controls select{max-width:180px}.pm-task .pm-open{font-size:12px}.pm-detail{position:fixed;top:12px;bottom:12px;right:8px}.pm-matrix .pm-order-col{width:26%}}
#pm-plan .pm-controls input[type=date]{display:inline-block;width:145px;flex:0 0 145px;margin:0}#pm-plan .pm-controls label{display:flex;flex-direction:row;color:#ead8aa;font-size:13px}#pm-plan .pm-controls select{width:180px;margin:0}#pm-plan .pm-controls input[type=checkbox]{width:18px;height:18px;margin:0}#pm-plan .stage-icon{min-width:0!important}
#pm-plan .pm-controls button,#pm-plan .pm-finish,#pm-plan .pm-detail>button,#pm-plan .pm-day-head button{border:2px solid #b28c45;border-radius:4px;color:#f8e5aa;background:radial-gradient(ellipse at top,#494133,#22241f 58%,#121714);box-shadow:0 0 0 1px #14140f,0 0 0 2px #675335,inset 0 0 0 2px #171911,inset 0 0 0 3px #816739;text-shadow:0 2px 2px #000;transition:transform .12s,border-color .18s}
#pm-plan .pm-controls button:hover,#pm-plan .pm-finish:hover{border-color:#ffe6a1;background:radial-gradient(ellipse,#785016,#221d10);box-shadow:0 0 8px #ffaf3799,inset 0 0 0 2px #714714}#pm-plan button:active{transform:translateY(1px)}
body.pm-tv .pm-calendar .pm-date button{font-size:13px!important;line-height:15px!important;padding:2px!important;margin-top:2px}body.pm-tv .pm-current .pm-order small{clear:both}
body.pm-tv #pm-plan .pm-backlog-host .wf-backlog{padding:0!important;width:100%}body.pm-tv #pm-plan .pm-backlog-host .wf-plan-list{display:flex!important;gap:10px;overflow-x:auto}body.pm-tv #pm-plan .pm-backlog-host .wf-plan-card{flex:0 0 250px!important;min-width:250px;max-width:280px;display:grid;grid-template-columns:1fr auto;gap:3px;padding:6px!important;margin:0!important;min-height:0}body.pm-tv #pm-plan .wf-plan-card>strong{font-size:12px;grid-column:1/-1;margin:0 25px 0 0!important}body.pm-tv #pm-plan .wf-plan-card>small{font-size:10px;margin:0!important}body.pm-tv #pm-plan .wf-plan-card>.project-badge{font-size:10px!important;padding:2px!important;margin:0!important}body.pm-tv #pm-plan .wf-plan-card>.project-due{display:none}body.pm-tv #pm-plan .wf-plan-card>.wf-status{font-size:10px;padding:2px}body.pm-tv #pm-plan .wf-plan-card button{font-size:10px;padding:3px 5px;min-height:22px}body.pm-tv #pm-plan .wf-plan-card>.stage-corner{width:22px;height:22px;min-width:22px}

/* Photos must remain visible after replacing the legacy calendar/backlog. */
#pm-plan .pm-order-photo{display:block!important;visibility:visible;opacity:1;object-fit:contain;border:1px solid #bc9e5f;background:#fff3d4;border-radius:2px;width:48px;height:52px;max-width:100%}
#pm-plan .pm-task:has(.pm-photo-link){display:grid;grid-template-columns:42px minmax(0,1fr);column-gap:7px}
#pm-plan .pm-task-media:empty{display:none}#pm-plan .pm-task-media:has(.pm-photo-link){grid-column:1;grid-row:1/3}
#pm-plan .pm-task:has(.pm-photo-link) .pm-task-top,#pm-plan .pm-task:has(.pm-photo-link) .pm-meta{grid-column:2}
#pm-plan .pm-photo-link{padding:0!important;border:0!important;background:none!important;box-shadow:none!important;min-height:0;display:block;width:40px}
#pm-plan .pm-photo-link .pm-order-photo{width:40px;height:46px}
#pm-plan .pm-detail>.pm-order-photo{width:120px;height:120px;margin:12px 0}
#pm-plan .pm-backlog-host .order-thumbnail{display:block!important;width:48px!important;height:52px!important;object-fit:contain;float:left;margin:0 7px 5px 0;opacity:1!important}
#pm-plan .pm-reopen{width:24px;min-height:24px;padding:2px;border:1px solid #9f7932;border-radius:3px;background:linear-gradient(#fae9bc,#d3b46d);color:#443211;font-size:16px}
#pm-order-return{padding:14px;margin:14px 0;background:linear-gradient(#fff3d4,#ead39d);border:1px solid #ab8539;color:#352b1a}#pm-order-return h3{font:18px Georgia;margin:0 0 10px}#pm-order-return p{font-size:12px}#pm-order-return label{display:flex;gap:10px;align-items:center}#pm-order-return select{flex:1}
body.pm-tv #pm-plan .pm-backlog-host .wf-plan-card:has(.order-thumbnail){padding-left:57px!important;position:relative}
body.pm-tv #pm-plan .pm-backlog-host .wf-plan-card>.order-thumbnail{position:absolute;left:6px;top:7px;width:44px!important;height:50px!important;float:none;margin:0}
#pm-plan .pm-backlog>h2{font-size:17px;overflow-wrap:anywhere}
/* Delivery calendar uses full order cards, including the saved photograph. */
#pm-plan .pm-date .pm-delivery-card{display:flex;flex-direction:column;align-items:stretch;gap:5px;text-align:left;background:var(--project-bg,#f5e6bf)!important;border-left-color:var(--project-color,#a68b50)!important}
#pm-plan .pm-delivery-card .pm-order-photo{width:100%;height:58px;object-fit:contain;margin:0;background:#fff7e4}
#pm-plan .pm-delivery-name{display:block;white-space:normal;overflow-wrap:anywhere;line-height:1.3}
#pm-plan .pm-delivery-card .pm-no-photo{width:100%;height:32px}
body:not(.pm-tv) #pm-plan .pm-month-grid{grid-template-rows:24px repeat(6,minmax(115px,auto))}
body.pm-tv #pm-plan .pm-date .pm-delivery-card{display:grid;grid-template-columns:26px minmax(0,1fr);gap:3px;align-items:start}
body.pm-tv #pm-plan .pm-delivery-card .pm-order-photo,body.pm-tv #pm-plan .pm-delivery-card .pm-no-photo{width:26px;height:32px;font-size:8px}
body.pm-tv #pm-plan .pm-delivery-name{font-size:12px;line-height:14px}

/* Approved layout: painting is 70% of its former 37% share. */
#pm-plan .pm-matrix col:first-child{width:26%}#pm-plan .pm-matrix col:nth-child(2){width:48.1%}#pm-plan .pm-matrix col:nth-child(3){width:25.9%}
#pm-plan .pm-task-top{display:grid;grid-template-columns:24px minmax(0,1fr) 26px}#pm-plan .pm-task-top input{width:22px;height:22px;accent-color:#9e772b}#pm-plan .pm-task-media .pm-order-photo{width:100%;height:90px;cursor:zoom-in}#pm-plan .pm-task-media:has(img){margin-bottom:8px}#pm-plan .pm-order>.pm-order-photo{width:100%;height:100px;cursor:zoom-in}#pm-plan .pm-task{display:block}#pm-plan .pm-task .stage-icon{position:static!important}#pm-plan .pm-open{min-width:0;overflow-wrap:anywhere}#pm-plan .pm-status,#pm-plan .wf-plan-card>.wf-status{display:none}
#pm-plan .pm-date{overflow:hidden;min-height:0;display:flex;flex-direction:column}#pm-plan .pm-date button{min-width:0;max-width:100%;flex-shrink:1;overflow:hidden;box-sizing:border-box}#pm-plan .pm-date .pm-delivery-card{display:flex;min-height:0;overflow:hidden}#pm-plan .pm-delivery-name{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;max-height:2.6em}#pm-plan .pm-delivery-card .pm-order-photo{max-height:55px;width:100%;min-height:0;object-fit:contain;cursor:zoom-in}#pm-plan [data-pm-day-orders]{flex-shrink:0;font-size:11px!important}body.pm-tv #pm-plan .pm-date .pm-delivery-card{display:flex;flex-direction:column}body.pm-tv #pm-plan .pm-delivery-card .pm-order-photo{height:24px;width:100%}body.pm-tv #pm-plan .pm-delivery-name{font-size:10px;line-height:11px;max-height:22px}
@media(max-width:700px){#pm-plan .pm-current{overflow-x:auto}#pm-plan .pm-matrix{min-width:660px!important}#pm-plan .pm-month-grid{grid-template-rows:24px repeat(6,105px)!important}#pm-plan .pm-month{width:100%}#pm-plan .pm-date{padding:2px}#pm-plan .pm-delivery-card .pm-order-photo{height:32px}#pm-plan .pm-delivery-name{font-size:10px;line-height:12px;max-height:24px}#pm-plan .pm-task .pm-open{font-size:14px}}
