/* Goodies · Site management v6 — brand tokens come from index.html (:root) */

/* In plan mode the 3D-only controls step aside */
body.mg-active .toolbar,body.mg-active footer,body.mg-active #navigationHint,body.mg-active .area-bubble{display:none!important}

/* ---------- Panel (desktop: left card) ---------- */
#sitePanel.mg-panel{width:344px;max-width:calc(100vw - 44px);padding:18px 18px 12px;display:flex;flex-direction:column;gap:12px;max-height:calc(100dvh - 196px)}
#sitePanel.mg-panel[hidden]{display:none!important}
.mg-grabber{display:none}
.mg-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.mg-head h2{font-size:30px;line-height:1.05;margin-top:2px}
.mg-head-actions{display:flex;gap:4px;margin-top:2px}
.mg-icon{width:34px;min-height:34px;padding:0;border-radius:10px;color:var(--ink-2)}
.mg-icon svg{width:18px;height:18px}
.mg-icon[aria-pressed=true]{background:var(--pink);color:var(--ink)}
#sitePanel .panelClose,#closeSite.mg-icon{position:static}

/* search + filters */
.mg-search{display:flex;align-items:center;gap:8px;background:var(--white);border-radius:12px;padding:0 12px;box-shadow:inset 0 0 0 1px var(--line);color:var(--ink-3)}
.mg-search:focus-within{box-shadow:inset 0 0 0 1.5px var(--ink-2)}
.mg-search svg{width:16px;height:16px;flex:none}
.mg-search input{flex:1;min-width:0;border:0;background:transparent;padding:10px 0;font-size:13.5px;color:var(--ink);outline:none}
.mg-chips{display:flex;gap:5px;overflow-x:auto;scrollbar-width:none;margin:10px -2px 0;padding:0 2px}
.mg-chips::-webkit-scrollbar{display:none}
.mg-chips button{flex:none;min-height:30px;padding:5px 11px;border-radius:99px;font-size:12px;color:var(--ink-2);background:var(--white);box-shadow:inset 0 0 0 1px var(--line)}
.mg-chips button.on{background:var(--pink);color:var(--ink);box-shadow:none}
.mg-count{font-size:11.5px;color:var(--ink-3);margin:10px 0 4px;font-weight:600}

/* list rows */
.mg-rows{display:flex;flex-direction:column;gap:2px;margin:0 -6px}
.mg-row{display:grid;grid-template-columns:52px 1fr 12px;align-items:center;gap:11px;padding:6px;border-radius:12px;text-align:left;white-space:normal;justify-content:stretch;min-height:0}
.mg-row:hover{background:rgba(250,187,203,.22)}
.mg-row.on{background:rgba(250,187,203,.45)}
.mg-row img{width:52px;height:38px;object-fit:cover;border-radius:8px;background:#f4eee9}
.mg-row-txt{display:flex;flex-direction:column;min-width:0}
.mg-row strong{font-size:13px;letter-spacing:.01em}
.mg-row small{font-size:11.5px;color:var(--ink-3);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mg-empty{font-size:13px;color:var(--ink-3);padding:16px 6px}

/* status dots: empty ring = not checked, pink = good, yellow = needs attention, ink = out of service */
.mg-dot{width:10px;height:10px;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--line-2)}
.mg-dot.ok{background:var(--pink);box-shadow:none}
.mg-dot.warn{background:var(--yellow);box-shadow:inset 0 0 0 1.5px rgba(64,64,64,.35)}
.mg-dot.out{background:var(--ink);box-shadow:none}

/* detail */
.mg-back{align-self:flex-start;padding:4px 8px 4px 2px;min-height:30px;font-size:12.5px;color:var(--ink-2);gap:4px}
.mg-back svg{width:16px;height:16px}
.mg-item{display:grid;grid-template-columns:76px 1fr;gap:12px;align-items:center;margin:8px 0 4px}
.mg-item img{width:76px;height:56px;object-fit:cover;border-radius:10px;background:#f4eee9}
.mg-item h3{margin:0;font-size:18px;font-weight:700;letter-spacing:.01em}
.mg-item p{font-size:12px;color:var(--ink-3);margin-top:2px}
.mg-group{display:block;margin-top:12px}
.mg-label{display:block;font-size:10.5px;letter-spacing:.14em;font-weight:700;color:var(--ink-3);text-transform:uppercase;margin-bottom:6px}
.mg-seg{display:flex;flex-wrap:wrap;gap:5px}
.mg-seg button{min-height:32px;padding:6px 11px;border-radius:99px;font-size:12px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line);color:var(--ink-2)}
.mg-seg button.on{background:var(--pink);color:var(--ink);box-shadow:none}
.mg-seg[data-field=condition] button[data-v=out].on{background:var(--ink);color:#fff}
.mg-seg button[data-v=repair].on,.mg-seg button[data-v=due].on,.mg-seg button[data-v=wash].on,.mg-seg button[data-v=damage].on,.mg-seg button[data-v=missing].on{background:var(--yellow)}
#mgNotes{width:100%;resize:vertical;min-height:58px;border:0;border-radius:12px;padding:10px 12px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line);font:inherit;font-size:13px;line-height:1.45;color:var(--ink)}
#mgNotes:focus{outline:none;box-shadow:inset 0 0 0 1.5px var(--ink-2)}
.mg-pos{display:flex;gap:5px;flex-wrap:wrap}
.mg-btn{min-height:34px;padding:6px 10px;border-radius:10px;font-size:12px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line);gap:5px}
.mg-btn svg{width:16px;height:16px}
.mg-btn.mg-sq{width:34px;padding:0}
.mg-hint{font-size:11.5px;color:var(--ink-3);line-height:1.45;margin-top:8px}
.mg-more{margin-top:14px;border-top:1px solid var(--line);padding-top:10px}
.mg-field{display:flex;flex-direction:column;gap:4px;margin-top:10px;font-size:11.5px;font-weight:600;color:var(--ink-3)}
.mg-field input{border:0;border-radius:10px;padding:8px 10px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line);font:inherit;font-size:13px;color:var(--ink)}
.mg-check{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:12.5px;font-weight:600}
.mg-dim{font-size:11.5px;color:var(--ink-3);margin-top:10px}
.mg-history{list-style:none;padding:0;margin:8px 0 0;font-size:11.5px;color:var(--ink-2);display:flex;flex-direction:column;gap:3px}
.mg-foot{border-top:1px solid var(--line);padding-top:8px;margin-top:auto}
#mgSaved{font-size:11px;font-weight:600;color:var(--ink-3)}
#mgSaved[data-state=fail]{color:var(--ink);background:var(--yellow);padding:2px 6px;border-radius:6px}

/* ---------- On-plan ID tags ---------- */
#mgLabels{position:fixed;inset:0;pointer-events:none;z-index:12}
.mg-tag{position:absolute;left:0;top:0;translate:-50% -50%;pointer-events:auto;min-height:0;padding:2px 7px;border-radius:99px;font-size:10.5px;font-weight:700;letter-spacing:.02em;background:rgba(255,253,246,.92);color:var(--ink);box-shadow:0 1px 4px rgba(40,40,40,.18);gap:4px}
.mg-tag:hover{background:var(--white)}
.mg-tag.warn::before,.mg-tag.out::before,.mg-tag.ok::before{content:"";width:7px;height:7px;border-radius:50%}
.mg-tag.ok::before{background:var(--pink)}
.mg-tag.warn::before{background:var(--yellow);box-shadow:0 0 0 1px rgba(64,64,64,.35)}
.mg-tag.out::before{background:var(--ink)}

/* ---------- Selection ring: centre handle moves, dot on the ring rotates ---------- */
#mgRing{position:fixed;left:0;top:0;width:0;height:0;z-index:13;pointer-events:none}
.mg-ring-circle{position:absolute;left:calc(var(--R) * -1);top:calc(var(--R) * -1);width:calc(var(--R) * 2);height:calc(var(--R) * 2);border-radius:50%;border:1.5px dashed rgba(64,64,64,.55);box-shadow:0 0 0 3px rgba(250,187,203,.55)}
.mg-ring-knob{position:absolute;left:-10px;top:-10px;width:20px;height:20px;min-height:0;padding:0;border-radius:50%;background:var(--white);box-shadow:0 0 0 2px var(--ink),0 2px 6px rgba(40,40,40,.25);pointer-events:auto;touch-action:none;cursor:grab}
.mg-ring-knob::before{content:"";position:absolute;inset:-12px;border-radius:50%}
.mg-ring-knob:hover{background:var(--pink)}
.mg-ring-move{position:absolute;left:-17px;top:-17px;width:34px;min-height:34px;height:34px;padding:0;border-radius:50%;background:rgba(255,253,246,.95);color:var(--ink);box-shadow:0 2px 10px rgba(40,40,40,.25);pointer-events:auto;touch-action:none;cursor:move}
.mg-ring-move:hover{background:var(--pink)}
.mg-ring-move svg{width:17px;height:17px}
.mg-ring-read{position:absolute;left:0;top:calc(var(--R) + 10px);translate:-50% 0;font-size:11px;font-weight:700;background:var(--ink);color:#fff;border-radius:6px;padding:2px 7px;white-space:nowrap}
.mg-ring-read:empty{display:none}
body.mg-dragging #mgLabels{opacity:.35}

/* ---------- Phone: bottom sheet ---------- */
@media(max-width:700px){
  #sitePanel.mg-panel{position:fixed;left:0;right:0;top:auto;bottom:0;width:auto;max-width:none;max-height:56dvh;border-radius:22px 22px 0 0;padding:6px 16px calc(10px + var(--safe-b));gap:10px;transition:max-height .25s ease}
  #sitePanel.mg-panel.mg-peek{max-height:212px;overflow:hidden}
  #sitePanel.mg-panel.mg-detail .mg-head{display:none}
  #sitePanel.mg-panel.mg-detail .mg-item{margin-top:0}
  .mg-grabber{display:flex;justify-content:center;align-items:center;width:100%;min-height:22px;padding:0;margin-bottom:-4px}
  .mg-grabber span{width:40px;height:4px;border-radius:4px;background:var(--line-2)}
  .mg-head h2{font-size:26px}
  .mg-row img{width:46px;height:34px}
  .mg-row{grid-template-columns:46px 1fr 12px}
  body.mg-dragging #sitePanel.mg-panel{opacity:.15;pointer-events:none}
  .mg-tag{font-size:10px;padding:2px 6px}
}

/* ---------- Export dialog ---------- */
#mgExportModal{position:fixed;inset:0;z-index:1500;background:rgba(40,40,40,.45);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:grid;place-items:center;padding:16px}
#mgExportModal[hidden]{display:none!important}
.mg-modal-card{width:min(520px,100%);max-height:calc(100dvh - 32px);overflow:auto;background:var(--paper);border-radius:var(--r-lg);padding:20px 22px;box-shadow:0 24px 80px rgba(40,40,40,.35);display:flex;flex-direction:column;gap:12px}
.mg-modal-sub{font-size:13px;line-height:1.5;color:var(--ink-2)}
.mg-opts{display:flex;flex-direction:column;gap:8px}
.mg-opt{display:grid;grid-template-columns:20px 1fr;gap:10px;align-items:start;padding:12px;border-radius:14px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line);cursor:pointer}
.mg-opt:has(input:checked){box-shadow:inset 0 0 0 1.5px var(--ink-2)}
.mg-opt input{margin-top:2px;width:16px;height:16px;accent-color:var(--ink)}
.mg-opt strong{display:block;font-size:13.5px}
.mg-opt small{display:block;font-size:12px;line-height:1.45;color:var(--ink-3);margin-top:2px}
.mg-modal-note{font-size:11.5px;color:var(--ink-3)}
.mg-progress{display:flex;flex-direction:column;gap:6px}
.mg-bar{height:4px;border-radius:4px;background:var(--line);overflow:hidden}
.mg-bar i{display:block;height:100%;width:0;background:var(--ink);transition:width .25s}
#mgXMsg{font-size:12px;font-weight:600;color:var(--ink-2)}
.mg-modal-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap}
.mg-primary{min-height:40px;padding:8px 18px;border-radius:12px;font-size:13.5px}
.mg-download{display:block;text-align:center;text-decoration:none;padding:13px;border-radius:14px;background:var(--pink);color:var(--ink);font-weight:700;font-size:14px}
.mg-download[hidden]{display:none}
.mg-textlink{align-self:center;font-size:12px;font-weight:600;color:var(--ink-3);text-decoration:underline;min-height:28px;padding:4px}

/* R06 furniture cards and selection tools */
#sitePanel.mg-panel{width:440px}
#mgRows,.mg-catalog{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
#mgRows[hidden],.mg-catalog[hidden]{display:none!important}
#mgRows .mg-row{display:flex;flex-direction:column;position:relative;align-items:stretch;padding:8px;min-width:0}
#mgRows .mg-row img{width:100%;height:80px;object-fit:contain}
#mgRows .mg-row small{white-space:normal;overflow-wrap:anywhere;font-size:11px}
#mgRows .mg-row strong{font-size:11px;overflow-wrap:anywhere}
#mgRows .mg-dot{position:absolute;right:6px;top:6px}
.mg-catalog .catalog-card{min-width:0}.mg-catalog .catalog-card img{width:100%;height:85px;object-fit:contain}
.mg-catalog .catalog-card strong{font-size:12px}
.mg-ring-copy{pointer-events:auto;position:absolute;left:calc(var(--R) + 8px);top:-17px;width:34px;height:34px;border-radius:50%;background:#fff;color:#283b31;font-size:24px;box-shadow:0 2px 10px #0003}
/* R09: Perspective sits in the left tab group, after Site management / Plan menu */
#mgViewToggle{display:inline-flex;gap:7px;align-items:center;min-height:36px;border-radius:10px;font-size:12.5px;color:var(--ink-2);padding:7px 12px;position:relative;margin-left:7px}
#mgViewToggle::after{content:"";position:absolute;left:-5px;top:9px;bottom:9px;width:1px;background:var(--line-2)}
#mgViewToggle svg{width:17px;height:17px;flex:none}
#mgViewToggle[aria-pressed=true]{background:var(--white);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line-2)}#mgViewToggle[hidden]{display:none}
@media(max-width:700px){#sitePanel.mg-panel{width:calc(100vw - 24px)}#mgRows,.mg-catalog{grid-template-columns:repeat(2,minmax(0,1fr))}#mgViewToggle span{display:none}#mgViewToggle{padding:7px 10px}}

.mg-ring-delete{pointer-events:auto;position:absolute;right:calc(var(--R) + 8px);top:-17px;width:34px;height:34px;border-radius:50%;background:#fff;color:#983d46;font-size:24px;box-shadow:0 2px 10px #0003}
#mgRestoreSite[hidden]{display:none!important}
.mg-catalog .catalog-card[hidden]{display:none!important}

/* ---------- v12 furniture photos (management/photos.js) ---------- */
.mg-count-row{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:10px 0 4px}
.mg-count-row .mg-count{margin:0}
.mg-textbtn{min-height:28px;padding:4px 10px;border-radius:99px;font-size:12px;font-weight:600;color:var(--ink);background:var(--pink);flex:none}
.mg-textbtn:hover{background:var(--pink-hover)}
.gp-badge{display:inline-flex;align-items:center;gap:2px;margin-left:7px;font-size:10.5px;font-weight:600;color:var(--ink-3);vertical-align:1px}
.gp-badge svg{width:12px;height:12px}

.gp-section{margin-top:10px}
.gp-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
.gp-link{display:inline-flex;align-items:center;gap:4px;min-height:0;padding:0;background:none;box-shadow:none;font-size:11.5px;font-weight:600;color:var(--ink-2);text-decoration:underline;text-underline-offset:2px}
.gp-link svg{width:12px;height:12px}
.gp-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.gp-tile,.gp-add{position:relative;aspect-ratio:4/3;border-radius:10px;overflow:hidden;background:#f4eee9;padding:0;min-height:0;display:grid;place-items:center}
.gp-tile img{width:100%;height:100%;object-fit:cover;display:block}
.gp-tile:hover img{filter:brightness(.92)}
.gp-tile.gp-noprev{font-size:10px;font-weight:700;color:var(--ink-3)}
.gp-add{cursor:pointer;background:var(--white);box-shadow:inset 0 0 0 1px var(--line-2);color:var(--ink-2);gap:2px;align-content:center;font-size:10.5px;font-weight:600;text-align:center}
.gp-add:hover{background:rgba(250,187,203,.22)}
.gp-add svg{width:20px;height:20px}
.gp-tile i{position:absolute;inset:0;background:rgba(255,253,246,.55)}
.gp-tile.gp-up i::after{content:"";position:absolute;left:50%;top:50%;width:16px;height:16px;margin:-8px;border-radius:50%;border:2px solid var(--ink);border-right-color:transparent;animation:gpspin .8s linear infinite}
.gp-tile.gp-fail{box-shadow:inset 0 0 0 2px #c0392b}
.gp-tile.gp-fail i{background:rgba(192,57,43,.25)}
@keyframes gpspin{to{transform:rotate(360deg)}}
.gp-msg{font-size:11.5px;line-height:1.45;color:var(--ink-3);margin-top:6px}
.gp-connect p{font-size:12px;line-height:1.45;color:var(--ink-2);margin-bottom:6px}
.gp-connect-row{display:flex;gap:6px}
.gp-connect input{flex:1;min-width:0;border:0;border-radius:10px;padding:8px 10px;font-size:13px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line-2);color:var(--ink)}
body.gp-dragging #sitePanel{box-shadow:0 0 0 3px var(--pink),var(--shadow)}

/* viewer + import dialogs share the export modal look */
.gp-modal{position:fixed;inset:0;z-index:1500;background:rgba(40,40,40,.55);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:grid;place-items:center;padding:16px}
.gp-modal[hidden]{display:none!important}
.gp-view-card{width:min(860px,100%);max-height:calc(100dvh - 32px);background:var(--paper);border-radius:var(--r-lg);padding:14px 16px 16px;display:flex;flex-direction:column;gap:10px;box-shadow:0 24px 80px rgba(40,40,40,.35)}
.gp-view-top{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.gp-view-top strong{display:block;font-size:15px}
.gp-view-top small{display:block;font-size:11.5px;color:var(--ink-3);word-break:break-all}
.gp-view-img{position:relative;display:grid;place-items:center;background:#f4eee9;border-radius:var(--r-md);min-height:220px;overflow:hidden}
.gp-view-img img{max-width:100%;max-height:calc(100dvh - 210px);object-fit:contain;display:block}
.gp-nav{position:absolute;top:50%;transform:translateY(-50%);width:38px;height:38px;min-height:0;padding:0;border-radius:50%;background:rgba(255,253,246,.9);box-shadow:var(--shadow)}
.gp-nav svg{width:18px;height:18px}
#gpVPrev{left:10px}#gpVNext{right:10px}
.gp-nav[hidden]{display:none}
.gp-view-actions{display:flex;justify-content:space-between;gap:8px}
.mg-btn.gp-armed{background:#c0392b;color:#fff;box-shadow:none}

.gp-import{width:min(620px,100%)}
.gp-drop{display:flex;align-items:center;justify-content:center;gap:8px;min-height:64px;border-radius:var(--r-md);background:var(--white);box-shadow:inset 0 0 0 1.5px var(--line-2);font-size:13px;font-weight:600;color:var(--ink-2);cursor:pointer}
.gp-drop svg{width:18px;height:18px}
.gp-drop.on,.gp-drop:hover{background:rgba(250,187,203,.3);box-shadow:inset 0 0 0 1.5px var(--pink)}
.gp-bulk{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--ink-2)}
.gp-bulk[hidden]{display:none}
.gp-irows{display:flex;flex-direction:column;gap:4px;max-height:44dvh;overflow:auto}
.gp-irows:empty{display:none}
.gp-irow{display:grid;grid-template-columns:56px 1fr 128px;gap:10px;align-items:center;padding:5px;border-radius:12px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line)}
.gp-irow img{width:56px;height:42px;object-fit:cover;border-radius:8px;background:#f4eee9}
.gp-irow strong{display:block;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gp-irow small{display:block;font-size:11px;color:var(--ink-3);min-height:1em}
.gp-irow.gp-ok{box-shadow:inset 0 0 0 1.5px var(--pink)}
.gp-irow.gp-bad{box-shadow:inset 0 0 0 1.5px #c0392b}
.gp-irow.gp-bad small{color:#c0392b}
.gp-irow.gp-up{opacity:.7}
.gp-import select,.gp-bulk select{min-width:0;width:100%;max-width:150px;border:0;border-radius:9px;padding:7px 8px;font-size:12.5px;background:var(--paper);box-shadow:inset 0 0 0 1px var(--line-2);color:var(--ink)}
#gpToast{position:fixed;left:50%;bottom:calc(24px + var(--safe-b));transform:translateX(-50%);z-index:1600;background:var(--ink);color:#fff;font-size:13px;padding:10px 16px;border-radius:12px;box-shadow:var(--shadow);max-width:calc(100vw - 32px)}
#gpToast[hidden]{display:none}
@media(max-width:700px){
  .gp-grid{grid-template-columns:repeat(3,1fr)}
  .gp-irow{grid-template-columns:48px 1fr;}
  .gp-irow select{grid-column:1/-1;max-width:none}
  .gp-view-card{padding:12px}
}
.gp-where{margin-top:6px;font-size:11.5px;color:var(--ink-3)}
.gp-where summary{cursor:pointer;font-weight:600}
.gp-where input{width:100%;margin-top:6px;border:0;border-radius:9px;padding:7px 9px;font-size:12px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line-2);color:var(--ink)}
.gp-where small{display:block;margin-top:4px;line-height:1.4}

/* R09c: grouped furniture tiles, By zone view, resizable panel */
#mgRows,.mg-catalog{grid-template-columns:repeat(auto-fill,minmax(118px,1fr))}
@media(max-width:700px){#mgRows,.mg-catalog{grid-template-columns:repeat(2,minmax(0,1fr))}}
.mg-views{display:flex;gap:4px;padding:3px;border-radius:12px;background:rgba(40,59,49,.07)}
.mg-views[hidden]{display:none}
.mg-views button{flex:1;min-height:32px;border-radius:9px;font-size:12.5px;font-weight:600;color:var(--ink-3);padding:4px 10px}
.mg-views button[aria-pressed=true]{background:#fff;color:var(--ink);box-shadow:0 1px 4px rgba(0,0,0,.14)}
.mg-qty{position:absolute;left:10px;top:10px;padding:1px 7px;border-radius:999px;background:#283b31;color:#fff;font-size:11px;font-weight:700;letter-spacing:.02em}
#mgRows .mg-row.mg-group{box-shadow:inset 0 0 0 1px var(--line-2)}
#mgRows .mg-row.mg-group.open{background:rgba(250,187,203,.3)}
.mg-members{grid-column:1/-1;display:grid;grid-template-columns:repeat(auto-fill,minmax(108px,1fr));gap:6px;padding:8px;border-radius:14px;background:rgba(250,187,203,.16)}
.mg-zonehead{grid-column:1/-1;display:flex;justify-content:space-between;align-items:baseline;gap:10px;padding:12px 4px 4px;border-bottom:1px solid var(--line-2)}
.mg-zonehead strong{font-size:14px}.mg-zonehead span{font-size:12px;color:var(--ink-3);font-weight:600}
.mg-zonehead:first-child{padding-top:2px}
.mg-resize{position:fixed;width:12px;cursor:ew-resize;z-index:30;touch-action:none}
.mg-resize[hidden]{display:none}
.mg-resize::after{content:"";position:absolute;left:4px;top:calc(50% - 24px);height:48px;width:4px;border-radius:4px;background:var(--line-2);transition:background .15s}
.mg-resize:hover::after,body.mg-resizing .mg-resize::after{background:var(--pink)}
body.mg-resizing{user-select:none;cursor:ew-resize}
@media(max-width:700px){.mg-resize{display:none!important}}

/* R09d: library merged into By type */
#mgLibrary{display:none!important}
#mgRows .mg-row .mg-plus{position:absolute;right:14px;top:62px;width:26px;height:26px;border-radius:50%;background:#fff;color:#283b31;border:1px solid var(--line-2);box-shadow:0 1px 4px rgba(0,0,0,.18);display:flex;align-items:center;justify-content:center;font-size:18px;font-weight:600;line-height:1;cursor:pointer}
#mgRows .mg-row .mg-plus:hover,#mgRows .mg-row:hover .mg-plus{background:var(--pink)}
#mgRows .mg-row.mg-ghost{border:1px dashed var(--line-2);background:rgba(255,255,255,.35)}
#mgRows .mg-row.mg-ghost img{background:#f4eee9;border-radius:8px}
.mg-qty0{background:rgba(40,59,49,.45)!important}

/* R34 · history buttons in the header, service number */
.mg-sep{width:1px;height:22px;background:var(--line);margin:6px 3px 0;align-self:flex-start}
.mg-icon:disabled{opacity:.35}
.mg-service{margin-top:12px}
.mg-service input{width:100%;border:0;border-radius:10px;padding:9px 11px;background:var(--white);box-shadow:inset 0 0 0 1px var(--line);font:inherit;font-size:15px;font-weight:600;color:var(--ink)}
.mg-service input:focus{outline:none;box-shadow:inset 0 0 0 2px var(--pink)}
/* R58: service no. tags — plain white, centred text, no ring, no status dot */
.mg-tag.mg-svc{background:#fff;color:var(--ink);font-size:11.5px;padding:2px 10px;justify-content:center;text-align:center;box-shadow:0 1px 4px rgba(40,40,40,.2)}
.mg-tag.mg-svc::before{display:none}
@media(max-width:700px){.mg-head-actions{gap:2px}.mg-head-actions .mg-icon{width:31px;min-height:31px}.mg-sep{margin:5px 1px 0}}

/* R51 · export drawing units */
.mg-units{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:10px}
.mg-units span{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2,#555);margin-right:4px}
.mg-units button{border:0;border-radius:999px;padding:7px 12px;font:inherit;font-size:12.5px;background:var(--white,#fff);box-shadow:inset 0 0 0 1px var(--line,#ddd);cursor:pointer;color:inherit}
.mg-units button[aria-pressed="true"]{background:#fabbcb;box-shadow:inset 0 0 0 1.5px var(--ink,#333);font-weight:700}

/* R52 · group selection banner */
.mg-multi{position:fixed;left:50%;top:84px;transform:translateX(-50%);z-index:60;display:flex;align-items:center;gap:12px;padding:9px 10px 9px 16px;border-radius:999px;background:#fabbcb;color:#3d3a36;box-shadow:0 6px 24px rgba(0,0,0,.14);font-size:13px;max-width:calc(100vw - 32px)}
.mg-multi[hidden]{display:none}
.mg-multi span{opacity:.8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mg-multi button{border:0;border-radius:999px;padding:6px 12px;background:#fff;font:inherit;font-weight:700;cursor:pointer}
@media (max-width:700px){.mg-multi span{display:none}}

/* R53 · service stations */
.mg-views{grid-template-columns:repeat(3,1fr)}
.mg-seats label{display:flex;align-items:center;gap:10px}
.mg-seats input{width:84px;padding:8px 10px;border-radius:10px;border:0;box-shadow:inset 0 0 0 1px var(--line,#ddd);font:inherit;background:var(--white,#fff)}
.mg-seats p{margin:6px 0 0;font-size:12px;opacity:.75}
.mg-svc-total{display:grid;gap:2px;padding:12px 14px;margin:4px 0 8px;border-radius:14px;background:#fabbcb33;box-shadow:inset 0 0 0 1px #fabbcb}
.mg-svc-total strong{font-size:20px}.mg-svc-total span{font-size:12.5px}.mg-svc-total small{font-size:12px;opacity:.75}
.mg-svc{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;padding:8px 10px;border-radius:12px;background:var(--white,#fff);box-shadow:inset 0 0 0 1px var(--line,#e6e2da);margin:6px 0}
.mg-svc.open{box-shadow:inset 0 0 0 1.5px var(--ink-2,#555)}
.mg-svc-no{min-width:38px;height:38px;padding:0 9px;border-radius:999px;border:0;background:#fff;color:var(--ink,#3d3a36);box-shadow:0 1px 4px rgba(40,40,40,.18);font:inherit;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;text-align:center}
.mg-svc-txt{border:0;background:none;text-align:left;font:inherit;cursor:pointer;min-width:0;padding:0;color:inherit}
.mg-svc-txt strong{display:block;font-size:13px}.mg-svc-txt small{display:block;font-size:11.5px;opacity:.7;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mg-svc-cov{display:grid;justify-items:end;gap:2px}
.mg-svc-cov input{width:64px;padding:6px 8px;border-radius:10px;border:0;box-shadow:inset 0 0 0 1px var(--line,#ddd);font:inherit;font-weight:700;text-align:right}
.mg-svc-cov small{font-size:10.5px;opacity:.65;white-space:nowrap}
.mg-svc-loose{width:100%;border:0;background:none;cursor:pointer;text-align:left;font:inherit}

/* R58: all plan tags centre their text */
.mg-tag{justify-content:center;text-align:center}

/* R59 · station photos in "By service" */
.mg-svc-txt{display:flex;align-items:center;gap:9px}
.mg-svc-txt>span{min-width:0;display:block}
.mg-svc-ph{width:64px;height:44px;object-fit:cover;border-radius:8px;flex:none;box-shadow:0 1px 3px rgba(40,40,40,.18);cursor:zoom-in}
.mg-svc-ph[hidden]{display:none}

/* R12: service-first planning, unified zones and persistent capacity */
.mg-svc-total{grid-column:1/-1;width:100%;box-sizing:border-box;gap:6px;padding:18px 20px}
.mg-svc-total strong{font-size:28px;line-height:1.15}.mg-svc-total small{line-height:1.55}
.mg-svc{grid-column:1/-1;min-width:0}.mg-service-zone{grid-column:1/-1;padding-left:10px;flex-wrap:wrap;gap:8px}.mg-zone-actions{display:flex;gap:6px;flex-wrap:wrap;margin-left:auto}
.mg-svc-chevron{margin-left:auto;font-size:23px;flex:none}.mg-svc-ph{cursor:pointer}.mg-svc-txt>span{flex:1}.mg-svc-txt{padding:5px 0;min-height:44px}
.mg-svc-loose{grid-column:1/-1;min-height:44px;padding:10px;border-radius:10px;background:#f4f0eb}.zone-add{grid-column:1/-1;justify-self:start}
#lsAdvSite{margin-top:18px}#lsAdvSite>summary{min-height:44px;box-sizing:border-box;padding:14px;cursor:pointer;font-weight:600}#lsAdvSite:not([open])>.ls-adv-body{display:none}
#planCapacity{display:none;position:fixed;right:18px;top:94px;z-index:25;max-width:240px;padding:12px 16px;text-align:left;border:1px solid #efb8c8;border-radius:16px;color:#454145;cursor:pointer;background:rgba(255,252,247,.96);box-shadow:0 4px 18px #0000000b}
body.mode-plan #planCapacity{display:grid;gap:3px}#planCapacity strong{font-size:24px;line-height:1.15}#planCapacity span{font-size:12px}#planCapacity small{font-size:10px;color:#796a70}body.zone-editing #planCapacity{display:none}
@media(max-width:700px){#planCapacity{top:142px;right:10px;max-width:180px;padding:9px 12px}#planCapacity strong{font-size:20px}#planCapacity small{max-width:156px}.mg-svc{gap:6px;padding:8px}.mg-svc-ph{width:50px;height:40px}.mg-svc-cov input{width:50px}.mg-zone-actions{margin-left:0}.mg-svc-total{padding:14px}}

/* R24: lightweight zone actions and actionable station validation. */
.mg-zone-actions button{border:0!important;background:none!important;box-shadow:none!important;border-radius:0;padding:5px 8px;color:#50555a;font:inherit;cursor:pointer}
.mg-zone-actions button:disabled{opacity:.35;cursor:default}.mg-zone-actions button:focus-visible{outline:2px solid #e58fa6;outline-offset:2px}.mg-zone-lock{display:inline-flex;align-items:center;gap:7px}.mg-zone-lock i{display:inline-block;width:28px;height:16px;background:#deded9;border-radius:12px;position:relative}.mg-zone-lock i:after{content:'';position:absolute;left:2px;top:2px;width:12px;height:12px;background:white;border-radius:50%;transition:transform .18s}.mg-zone-lock[aria-checked=true] i{background:#f5b5c9}.mg-zone-lock[aria-checked=true] i:after{transform:translateX(12px)}
.mg-needs-edit input{border-color:#d85c8b!important;animation:mg-field-pulse 1.8s ease-in-out infinite}#mgAssignmentHint{display:block;color:#b6436b;font-size:12px;line-height:1.5;margin-top:6px}#mgAssignmentHint[hidden]{display:none}@keyframes mg-field-pulse{50%{box-shadow:0 0 0 4px #f9bacb55}}@media(prefers-reduced-motion:reduce){.mg-needs-edit input{animation:none}.mg-zone-lock i:after{transition:none}}
/* R31f · loading notice editor */
.sn-section{margin:4px 0 14px;padding:12px;border-radius:14px;background:rgba(255,255,255,.75);box-shadow:inset 0 0 0 1px var(--line)}
.sn-section h3{font-size:13px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-3);margin:0 0 4px}
.sn-intro,.sn-help{font-size:12px;color:var(--ink-2);margin:0 0 8px;line-height:1.4}.sn-help{margin:8px 0 0;color:var(--ink-3)}
.sn-check{display:flex;align-items:center;gap:6px;font-size:12.5px;margin:6px 0}
.sn-field{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:600;color:var(--ink-2);margin-top:8px}
.sn-field textarea{font:inherit;font-weight:400;font-size:14px;line-height:1.45;color:var(--ink);padding:8px 10px;border-radius:10px;border:1px solid var(--line-2,#ddd);background:#fff;resize:vertical;min-height:72px;box-sizing:border-box;width:100%}
.sn-row{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
/* R54 · '+ N unassigned seats' is its own switch for the red ! marks on the plan */
#planCapacity small{max-width:240px;text-decoration:underline;text-decoration-color:rgba(121,106,112,.45);text-underline-offset:2px;padding:3px 0;cursor:pointer}
#planCapacity small.mg-unassigned-on{color:#b02a3a;font-weight:600;text-decoration-color:currentColor}
