.tag-monitor-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tag-monitor-toggle input { accent-color: var(--teal); }
.tag-monitor-window-head { display: flex; justify-content: flex-end; }
.tag-monitor-maximize { position: relative; }
.tag-monitor-maximize summary { padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; background: white; color: #304249; cursor: pointer; font-size: 13px; font-weight: 600; }
.tag-monitor-maximize > div { position: absolute; z-index: 6; right: 0; top: calc(100% + 4px); display: grid; min-width: 130px; padding: 4px; gap: 4px; border: 1px solid var(--line); border-radius: 7px; background: #e8f4f2; box-shadow: 0 6px 18px #102d3430; }
.tag-monitor-maximize button { text-align: left; white-space: nowrap; }
.tag-monitor-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; margin: 14px 0 6px; }
.tag-monitor-toolbar label { font-size: 12px; }
.tag-monitor-toolbar input { width: 110px; }
.tag-monitor-plot { border: 1px solid var(--line); border-radius: 7px; background: #fff; overflow-x: auto; }
.tag-monitor-plot.drag-over { outline: 2px dashed var(--teal); }
#tagMonitorCanvas { display: block; width: 100%; height: clamp(300px, 46vh, 540px); cursor: crosshair; touch-action: pan-y; }
.tag-monitor-pens { display: grid; grid-template-columns: repeat(auto-fit,minmax(250px,1fr)); gap: 7px; margin-top: 10px; }
.tag-monitor-pen { display: grid; grid-template-columns: 9px minmax(0,1fr) auto auto; align-items: center; gap: 7px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.tag-monitor-pen span { overflow-wrap: anywhere; }
.tag-monitor-pen small { display: block; color: #536a71; }
.tag-monitor-pen select,.tag-monitor-pen button { padding: 4px 6px; }
.tag-monitor-swatch { height: 20px; border-radius: 3px; }
#tagRows:not(.monitor-enabled) .tag-monitor-add { display: none; }
#tagRows.monitor-enabled tr[data-monitor-tag] { cursor: grab; }
dialog.tag-monitor-expanded {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
}
.tag-monitor-stage {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: clamp(10px, 2vw, 24px);
  background: #e8f4f2;
  overflow: auto;
  overscroll-behavior: contain;
}
.tag-monitor-stage:fullscreen { width: 100%; height: 100%; }
.tag-monitor-expanded-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tag-monitor-expanded-head button { flex: 0 0 auto; }
.tag-monitor-stage #tagMonitorWindow { display: flex; flex: 1 0 0; flex-direction: column; min-width: 0; min-height: min(470px, 95vh); }
.tag-monitor-stage .tag-monitor-window-head { display: none; }
.tag-monitor-stage .tag-monitor-plot { flex: 1 0 210px; min-height: 210px; }
.tag-monitor-stage #tagMonitorCanvas { height: 100%; }
.tag-monitor-stage .tag-monitor-pens { max-height: min(19vh, 160px); overflow-y: auto; }
